Changes between Version 3 and Version 4 of waue/LinuxGateway
- Timestamp:
- Feb 12, 2009, 3:05:08 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
waue/LinuxGateway
v3 v4 13 13 兩張網卡,eth1對內,eth2對外: 14 14 || eth1 || 192.168.1.254 || 內部區網的gateway address|| 15 || eth2 || 140.110.1 41.130|| 對外連接的網卡設定||15 || eth2 || 140.110.111.222 || 對外連接的網卡設定|| 16 16 17 17 * drbl client … … 29 29 30 30 iface eth2 inet static 31 address 140.110.141.130 32 netmask 255.255.255.0 33 network 140.110.141.0 34 broadcast 140.110.141.255 35 gateway 140.110.141.254 31 address 140.110.111.222 32 netmask 255.255.255.055 33 gateway 140.110.111.254 36 34 dns-nameservers 140.110.16.1 37 35 dns-search nchc.org.tw … … 55 53 56 54 === NAT === 57 打開ip forward ,並讓防火牆開啟NAT功能55 打開ip forward 58 56 {{{ 59 57 $ echo 1 > /proc/sys/net/ipv4/ip_forward 58 }}} 59 60 讓防火牆開啟NAT功能,由於是固定ip,用snat較有效率 61 {{{ 62 $ iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to 140.110.111.222 63 }}} 64 65 PS:若對外ip是用pppoe的方式,或不是固定ip,則動態配置用MASQUERADE比較不麻煩,壞處是較無效率 66 {{{ 60 67 $ iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE 61 68 }}} 62 63 69 ==== 重開機也有效的NAT設定 ==== 64 70 以上的指令只是暫時有效,但一重開機後又回覆預設值,因此修改ip forward預設值才是長久之計: