How do I configure routing table to add correct gateway?

6,202

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
Share:
6,202

Related videos on Youtube

Zenet
Author by

Zenet

Updated on September 17, 2022

Comments

  • Zenet
    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
    Zenet over 13 years
    Hi 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
    RobotHumans over 13 years
    not 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
    RobotHumans over 13 years
    edited answer to be more clear i think
  • Zenet
    Zenet over 13 years
    I 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
    Zenet over 13 years
    What do you mean by tap interface? I don't think I have such a thing...
  • RobotHumans
    RobotHumans over 13 years
    you don't have to set promisc on br0...ifconfig br0 dhcp && ifconfig br0 down && ifconfig br0 up should do it
  • RobotHumans
    RobotHumans over 13 years
    what is the output of brctl show
  • RobotHumans
    RobotHumans over 13 years
    to add a tap interface: sudo tunctl -t tap0
  • Zenet
    Zenet over 13 years
    On the host: bridge name bridge id STP enabled interfaces br0 8000.001f293a81b2 yes eth0
  • Zenet
    Zenet over 13 years
    I don't get it! it's never going to work... I give up :'( (for today)
  • RobotHumans
    RobotHumans over 13 years
    they 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