顯示具有 router 標籤的文章。 顯示所有文章
顯示具有 router 標籤的文章。 顯示所有文章

2015-02-03

iptables設定multiple ip對應內部不同private ip

實體IP 虛擬IP
11.22.33.01 192.168.1.10
11.22.33.02 192.168.1.11
11.22.33.03 192.168.1.12

設定大概就這個樣子:(vlan1是否為WAN Bridge、public ip mask是否為29,請自行修改)
/usr/sbin/ip addr add 11.22.33.01/29 dev vlan1
/usr/sbin/ip addr add 11.22.33.02/29 dev vlan1
/usr/sbin/ip addr add 11.22.33.03/29 dev vlan1

/usr/sbin/iptables -t nat -I POSTROUTING 1 -p all -s 192.168.1.10 -j SNAT --to 11.22.33.01
/usr/sbin/iptables -t nat -I POSTROUTING 1 -p all -s 192.168.1.11 -j SNAT --to 11.22.33.02
/usr/sbin/iptables -t nat -I POSTROUTING 1 -p all -s 192.168.1.12 -j SNAT --to 11.22.33.03

/usr/sbin/iptables -t nat -I PREROUTING -d 11.22.33.01 -j DNAT --to-destination 192.168.1.10
/usr/sbin/iptables -t nat -I PREROUTING -d 11.22.33.02 -j DNAT --to-destination 192.168.1.11
/usr/sbin/iptables -t nat -I PREROUTING -d 11.22.33.03 -j DNAT --to-destination 192.168.1.12

然後貼在firewall script,再設定一下 port forwarding,完成。

沒usb玩optware

手邊有台老機子WRT54GS,近來刷了 Shibby 1.28 (K26/build5x-101-EN),
但就是沒有USB可以玩,JFFS空間也不夠大,於是想到利用NAS的SAMBA空間來玩玩optware,沒有USB的機子想玩optware可以參考看看。

tomato上架Nginx + PHP 5(FastCGI)

昨天架好了Nginx + PHP 5(FastCGI) 的環境,把作法分享出來。

環境:
TOMATO by shibby K26/build5x-101

前置工作:
optware安裝在/opt下
port 80 確定沒有服務 (ap管理介面請避開 port 80)

WL-500GPV2 (OLEG) 無法更新DDNS...囧

我那台華碩鳥貨 WL-500GPV2的ddns發現失效了,log出現:
ddns update: the IP address "wget: Unable to" is invalid

原來是 ip.xten.net 服務已經掛了,這是用來取得wan ip的一種爛方式,
所以ASUS寫的script真是不可靠 = =
(那乾脆做用dnsomatic不就好了?api類似dyndns)
還好Oleg有內建 ez-ipupdate ,也可以拿來更新ddns
http://leaf.sourceforge.net/doc/bucu-ezipupd.html
(DD-WRT用的是inadyn)