I have a linux server (Ubuntu 12) with 2 NIC's.
eth0 is connected WAN (inet 10.0.2.15 mask 255.255.255.0)
eth1 is connected LAN (inet 192.168.0.1 mask 255.255.255.0)
I want my windows machine to connect to the internet. Win -> eth1 -> eth0 -> internet
Added to: /etc/network/interfaces
auto eth1
iface eth1 inet static
address 192.168.0.1
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
I added this to: /etc/dhcp/dhcpd.conf
authoritative;
option domain-name "mydomain";
option domain-name-servers 8.8.8.8, 8.8.4.4, 192.168.0.1;
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.32 192.168.0.128 ;
option routers 192.168.0.1 ;
}
and in /etc/ufw/before.rules
# nat rules
*nat
:POSTROUTING ACCEPT [0:0]
# Forward all packes through eth0
-A POSTROUTING -s 10.0.2.0/24 -o eth0 -j MASQUERADE
# WARNING, do not remove COMMIT line. This breaks the loading
COMMIT
I have set my windows machine's default gateway to 192.168.0.1 and its IP to 192.168.0.40
My windows machine can ping my eth1 but not the internet
I think the problem is the postrouting rule for ufw but I find no documentation on its syntax (yes Im just copy/pasting a tutorial)..
EDIT: Extra info:
output ip addr and output ip route http://puu.sh/2Yfd7.png
output iptables -L FORWARD https://i.stack.imgur.com/Mas98.png
apologies for screenshots.
ip addr
,ip route
andiptables -L FORWARD -nv
(and all chains referenced from FORWARD).