I am fightning with this for like 10 days now i really need to ask you guys, i hope someone has 5 mins time to explain me what i am doing wrong!
For the start i wanted to configurate a router for my network,i follwed this tutorial
My current network:
www --> router --> host --> vmserver(dhcp/dns) --> dhcpclient
--> 192.168.0.1 --> 192.168.0.2--> 172.22.22.1 --> 172.22.22.21
Router:192.168.0.1, Host:dhcp, VMserver-2x Network cards -bridged
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
# WAN
auto eth0
iface eth0 inet dhcp
# LAN
auto eth1
iface eth1 inet static
address 172.22.22.1
netmask 255.255.255.0
network 172.22.22.0
broadcast 172.22.2.255
The dhcp seems to work now, but i have no connection to the internet what do i need to do?
i also tried saving the following to /etc/rc.local
:
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables –table nat -A POSTROUTING -o eth0 -j MASQUERADE
but i still can not ping
192.168.0.2(host) or 192.168.0.1(router).
apo@apo-VirtualBox:~$ sudo route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth1
172.22.22.0 * 255.255.255.0 U 0 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
-
ping
192.168.0.2(Host) > 192.168.0.18 (eth0) = yes
192.168.0.2 (Host) > 17.22.22.21 (dhcp) = no
172.22.22.1 (router) > 192.168.0.2 (Host) = yes
172.22.22.1 (router) > 172.22.22.21 (dhcp) = yes
172.22.22.1 (router) > www.google.de > yes
172.22.22.21 (Clientdhcp) > 192.168.0.18 (eht0) = yes
172.22.22.21 (Clientdhcp) > 192.168.0.2 (Host)= no
And yes 192.168.0.1 (router) is my gateway.
apo@apo-VirtualBox:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:97:35:79 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.18/24 brd 192.168.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe97:3579/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:32:e6:ca brd ff:ff:ff:ff:ff:ff
inet 172.22.22.1/24 brd 172.22.22.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe32:e6ca/64 scope link
valid_lft forever preferred_lft forever
i also have dns (for this router, so i access to websites).
cat /proc/sys/net/ipv4/ip_forward
should be 1. – Doug Smythies Apr 17 '15 at 18:48