Setting up NAT with iproute2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All...
         I'm trying to set up 1:1 NAT but the Windows machine (192.168.3.1) 
that I'm trying to set up the NAT for is just taking the Linux machine's 
default IP instead. I'm connecting to the Internet by PPPoE and have 3 IPs. 
On the LAN I have 4 Windows machines (192.168.1.2, 192.168.2.1, 
192.168.2.2, 192.168.3.1) and a Linux machine. For the Linux machine and 
192.168.1.2 I'm using ppp0, for 192.168.2.* I'm using ppp1 and i want to 
setup 1:1 NAT for 192.168.3.1 and ppp2. This is my whole setup so if anyone 
notices anything wrong PLEASE let me know!

ifconfig eth1 192.168.1.1 up
route add -net 192.168.2.0 netmask 255.255.255.0 eth1
route add -net 192.168.3.0 netmask 255.255.255.0 eth1

ipchains -P input ACCEPT
ipchains -P output ACCEPT
ipchains -P forward DENY
ipchains -F forward
ipchains -F input
ipchains -F output
ipchains -A forward -j MASQ
echo 1 > /proc/sys/net/ipv4/ip_forward

route add default ppp0

ip rule add from 192.168.1.2 table Link0
ip rule add from 192.168.2.1 table Link1
ip rule add from 192.168.2.2 table Link1
ip route add default via 1st.internet.ip dev ppp0 table Link0
ip route add default via 2nd.internet.ip dev ppp1 table Link1

ip route del 3rd.internet.ip table local
ip rule add from 192.168.3.1 nat 3rd.internet.ip table main
ip route add nat 3rd.internet.ip via 192.168.3.1 table local

ip route flush cache


Thanks

Rami AlZaid  <rami@alzaid.com>  *  ICQ # 1071118
WebPages: www.alzaid.com  *  www.kuwait.nu  *  www.wooyeah.com

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux