How do I configure routing table to add correct gateway?
Solution 1
eth0 needs to be in promisc mode to pass traffic to the bridge
my setup is physical eth0 in promisc with no ip address, br0 with an dhcp ip and using the bridge as my "interface" for the hardware machine with a route to the gateway from dhcp, then a tap interface added to the bridge and this is used as a "bridged" interface in the virtualization product. does that help?
a tutorial on setting up virtualization with tap interfaces and reachability: http://www.blindhog.net/linux-bridging-for-gns3-lan-communications/
Solution 2
In my case helped iptables on router:
iptables -A POSTROUTING --table nat ! -o tap0 -j MASQUERADE
Related videos on Youtube
Zenet
Updated on September 17, 2022Comments
-
Zenet over 1 year
I'm getting this error when I try to ping 8.8.8.8 from my Virtual Machine:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. From 172.30.8.135: icmp_seq=1 Redirect Host(New nexthop: 172.30.8.254) From 172.30.8.135: icmp_seq=2 Redirect Host(New nexthop: 172.30.8.254)
When I try wget http://www.google.com I get failed: connection timed out.
This is the output of route -n:
Destination Gateway Genmask Flags Metric Ref Use Iface 172.30.8.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 172.30.8.135 0.0.0.0 UG 0 100 0 eth0
This is how my network looks like: I have created br0 as a bridge over eth0 to run this VM. The host has this IP 172.30.8.135.
The host has access to internet through eth0 and this is the output of route inside the host:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 172.30.8.0 0.0.0.0 255.255.255.0 U 0 0 0 br0 0.0.0.0 172.30.8.254 0.0.0.0 UG 100 0 0 br0
Thanks in advance for any clues on this!
-
Zenet over 13 yearsHi aking :) (it's me again :D) How do I do that? I tryed "ifconfig eth0 promisc" in the Vm. But that didin't change anything...
-
RobotHumans over 13 yearsnot in the VM, on your physical eth0...you can give your br0 an IP and might be able to use that to browse from the physical machine if that's required
-
RobotHumans over 13 yearsedited answer to be more clear i think
-
Zenet over 13 yearsI just added promisc for eth0 and br0 on the host machine. But it doesn't change anything in the VM. How do I set an IP for the bridge br0?? The host IP is 172.30.8.135 in br0.
-
Zenet over 13 yearsWhat do you mean by tap interface? I don't think I have such a thing...
-
RobotHumans over 13 yearsyou don't have to set promisc on br0...ifconfig br0 dhcp && ifconfig br0 down && ifconfig br0 up should do it
-
RobotHumans over 13 yearswhat is the output of brctl show
-
RobotHumans over 13 yearsto add a tap interface: sudo tunctl -t tap0
-
Zenet over 13 yearsOn the host: bridge name bridge id STP enabled interfaces br0 8000.001f293a81b2 yes eth0
-
Zenet over 13 yearsI don't get it! it's never going to work... I give up :'( (for today)
-
RobotHumans over 13 yearsthey have videos on blindhog walking you through it...browse around over there a bit...i'll try and put one together to mirror the settings you are trying to get and post it somewhere