nmb86
Posts: 3
Joined: Thu Aug 15, 2019 9:51 pm

Setting up second eth interface

Sat Aug 17, 2019 1:36 am

Hello everyone. Let me start by saying that I am new to Raspberry Pi's, but have some experience with Linux Ubuntu.

I am working on a project to improve some network training I conduct. Being aviation related, there's no way I can get approval to buy the actual aircraft parts, so I'm trying to use RasPi's (running Raspian Buster) to simulate/emulate the actual components.

I have html based emulators for maintenance GUI's for some systems. I already managed to set up a Pi with Apache and host one of these emulators. With a computer on a 10.x.x.x network, I can access it through the router's WAN port at 172.29.55.x as it's set up on the aircraft.

What I would ultimately like to do, is take this current Pi, and set a second ethernet interface with the same IP. The component I'm mimicking has a secondary "maintenance" port that allows access to the GUI, but only for a computer with a static IP of 172.29.55.x. I understand the USB ports are connected to the LAN interface and a USB to RJ45 adapter should work.

So, here's what I can't figure out how to do.

Eth0 - static IP of 172.29.55.1/24, connected using the RJ45 port to the WAN port of my training network (currently functioning, can be accessed from the 10.x.x.x network)
Eth1 - static IP of 172.29.55.1/24, connected to via USB to Ethernet adapter but only by a computer set to 172.29.55.10 (what I'm adding)

If possible, it would be nice to add another USB to Ethernet adapter (eth2) to connect another Pi (different IP address) that would allow clients to ping the second Pi from my 10.x.x.x network; however I am not opposed to purchasing an ethernet switch.

I have tried adding an eth1 interface in by editing /etc/dhcpcd.conf and /etc/networks/interface, but probably not correctly.

If anyone can help me, I'd be very appreciative.

epoch1970
Posts: 3564
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Setting up second eth interface

Sat Aug 17, 2019 10:39 am

You cannot have 2 interfaces active with the same IP address on a network.

If you used a network switch, connected to it:
- the Pi,
- the 172.29.55.10 machine,
- the router’s LAN interface

would that be acceptable?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

nmb86
Posts: 3
Joined: Thu Aug 15, 2019 9:51 pm

Re: Setting up second eth interface

Sun Aug 18, 2019 4:18 pm

Perhaps I didn't explain this properly. I know basic networking (and yes, I understand that two devices cannot have the same IP, but this is one device with one IP but two Eth interfaces)

I am overall trying to prevent the need for an switch (everything I purchase for this project has to get approval from higher up, and they don't want to spend the money). I know I could run the connection from the router into a managed switch and probably set up one of the ports on the switch to only allow access to the maintenance computer, but that't not what I want if I can avoid it.

So, it's just the one Pi, but with two ethernet ports/interfaces, the built in RJ45 and then a USB adapter. I want to set up the USB adapter to only communicate with a laptop with the 172.29.55.10 static IP while the RJ45 port communicates with the router.

User avatar
rpdom
Posts: 15019
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Setting up second eth interface

Sun Aug 18, 2019 5:03 pm

You could create a bridge interface and link the two physical interfaces to it. The IP address would belong to the bridge and could be accessed via either interface.

epoch1970
Posts: 3564
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Setting up second eth interface

Sun Aug 18, 2019 5:55 pm

nmb86 wrote:
Sun Aug 18, 2019 4:18 pm
I understand that two devices cannot have the same IP, but this is one device with one IP but two Eth interfaces
Host the network adapters any way you want in any number of computers you want, from the network standpoint the situation is the same. No two MAC addresses (adapters) can claim the same IP.
You need to setup a bridge, as rpdom said above.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

nmb86
Posts: 3
Joined: Thu Aug 15, 2019 9:51 pm

Re: Setting up second eth interface

Sun Aug 18, 2019 7:31 pm

Okay, thank you.

Would anyone be able to provide a link to a tutorial on setting up additional interfaces and bridges? I know I'll need to install bridge-utils, but beyond that, I'm not sure what to do.

epoch1970
Posts: 3564
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Setting up second eth interface

Sun Aug 18, 2019 10:02 pm

You don’t absolutely need bridge-utils, the “ip” command is supposed to have swallowed it. More or less. It is still convenient.

I have this to offer: https://wiki.archlinux.org/index.php/Sy ... _interface
Shows how to create a bridge with systemd (the modern way). Doesn’t show how to specify a fixed IP config to the bridge, but it is like any other interface under systemd-networkd.
Note that the Arch doc adds members matching the wildcard “eth*” to the bridge. Funky but not really safe... I would recommend you create 2 .network files, one for eth0 and one for eth1.

Important Raspbian-specific bit: add “denyinterfaces br0 eth0 eth1” in dhcpcd.conf near the beginning of the file, to make sure dhcpcd does not interfere with systemd-networkd.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Beginners”