1

Given an Ubuntu machine A with N > 2 Ethernet ports, I want to use one of the ports to connect to my router R that has a DHCP server on it and connect machine A to the internet through it. I also need to connect more devices via the remaining ports of machine A, so that they also get IPs directly from the router R. I don't want to have a DHCP server or any additional subnetworks on machine A.

I tried to setup a simple bridge between all the ports, but none of the devices get internet this way. There are many types of bridgings, virtual networks, etc. listed in this post, but I don't seem to understand, which option I should go with.

3
  • What exactly did you do? Can you edit your question to show the configuration? That sounds like something that should work by putting all the network interfaces on a bridge, and then running A's own DHCP client on the bridge interface. but I don't remember if there were some gotchas with doing that. That would be the very first item listed on the linked page. The others don't seem relevant to your case, and some of them are rather heavy anyway.
    – ilkkachu
    Mar 21 at 15:09
  • Note though that bridging on A would require A to be online for the network to work on the others, and well, just using a small, cheap, fanless switch instead might have some advantages.
    – ilkkachu
    Mar 21 at 15:12
  • I suppose the NICs must be in promiscuous mode so that they pick up traffic that is not destined to them. Perhaps the kernel must have ip_forward set, too. I do agree that a full-fledged computer is a poor solution. Invest 20$ in a 4-port switch. Mar 21 at 15:35
1

I tried to setup a simple bridge between all the ports,

That's the right approach.

but none of the devices get internet this way.

... and it's really difficult to debug this if you don't give details about what you did.

There are many types of bridgings, virtual networks, etc. listed in this post, but I don't seem to understand, which option I should go with.

After a quick look all of those seem to complicated, or don't really match your situation.

First step is to set up everything manually, then see how you can make it persistent. Assuming your ports are eth0, eth1, and eth2, do something like:

ip link add br0 type bridge
ip link set eth0 master br0
ip link set eth1 master br0
ip link set eth2 master br0
ip link set br0 up

If eth0 was attached to your router R before, now you need to change the configuration on A so that br0 is used everywhere eth0 was before. In particular, any ip address assigned to eth0 is no longer valid, and the DHCP client should manage br0.

Once you've done that, test that A has connectivity to the router, and to the internet.

Then attach machines B and C to eth1 and eth2, see that some DHCP client is running on B and C, and see that they get DHCP responses. Debug with tcpdump or wireshark if necessary.

Then find out which of the many networking flavours you have on A (systemd, network manager, old-style /etc/network/interfaces, and make the bridge permanent. Google for documentation according to the flavour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.