I have a scenario in which there is a server machine with two interfaces. Each of these interfaces has its own IP address. The server machine hosts an HTTP server, which should be accessible via both of the interfaces.
Full python script to reproduce this situation:
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.net import Mininet
from mininet.topo import Topo
class TestTopology(Topo):
def __init__(self):
Topo.__init__(self)
host1_id = self.addHost('h1')
host2_id = self.addHost('h2')
server_id = self.addHost('server')
self.addLink(server_id, host1_id)
self.addLink(server_id, host2_id)
def configure_network(network):
server = network.get('server')
server.setIP('10.0.0.10', intf='server-eth0')
server.setMAC('00:00:00:00:00:10', intf='server-eth0')
server.setIP('10.0.0.11', intf='server-eth1')
server.setMAC('00:00:00:00:00:11', intf='server-eth1')
server.cmd("python -m SimpleHTTPServer 8080 &")
# Run 'sudo python *path_to_this_script*' in mininet VM.
if __name__ == '__main__':
setLogLevel('info')
net = Mininet(topo=TestTopology())
configure_network(net)
net.pingAll()
CLI(net)
The SimpleHTTPServer is listening on 0.0.0.0 as default.
The 'pingAll' test shows that the server is accessible by h1 (and vice versa), but it's not the case for h2.
Of course, I can't wget
from h2 either.
How to configure the server interfaces so that the server responds both to ping
and wget
commands via both of these interfaces?
/etc/network/interfaces
on the server contains some configuration, but it is regarding a non-existent eth0
interface, so I assumed it is not used.
NOTE: I've already learned that for linux, a particular IP != network interface. The server responds for pings to both 10.0.0.10 and 10.0.0.11 from h1, but I would like for it to respond on both physical interfaces.
I see that you configured the IP address for the both interfaces correctly, but there's no ethernet link connecting the second interface on other hosts, that's why there's no connectivity on that interface. In order to configure it properly, you must:
I hope it helps to solve the problem...