a_bet
Posts: 8
Joined: Tue Dec 09, 2014 10:30 pm

Set Up Multiple Ethernet Networks with different static IP

Tue Dec 09, 2014 10:43 pm

Hi, i'm building a small portable bluethoot player involving the Pi and a old radio.
Since i'm gonna work on it on 2 different network i'd like to have static IP on both them.
I configured the wpa_supplicant/wpa_supplicant.conf to set uo the wifi and it works pretty good, but I'd like to use the ethenet too when I need more speed.
So her's my question: how do I configure the /etc/network/interfaces so that I can set up multiple networks?
Also, I'd like to leave the dhcp in case I'm wiring the pi to a new network.

Any help would be appreciated!!
Best regards,
a_bet

matusiam
Posts: 10
Joined: Fri Oct 25, 2013 11:46 pm

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 2:04 am

Hi,


I'm not sure where the problem is - just configure a static entry for eth0 on the raspberry pi and your sorted.

Example :

auto eth0
iface eth0 inet static
address 192.168.1.155
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255


Unless you are after something totally different...


Regards

User avatar
B.Goode
Posts: 16300
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 8:23 am

GOOGLE: "linux bind two ip addresses debian"

This is one result that looks 'correct' - http://www.racksrv.com/portal/knowledge ... buntu.html
Beware of the Leopard

drgeoff
Posts: 14032
Joined: Wed Jan 25, 2012 6:39 pm

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 12:13 pm

B.Goode wrote:GOOGLE: "linux bind two ip addresses debian"

This is one result that looks 'correct' - http://www.racksrv.com/portal/knowledge ... buntu.html
The OP wants to use TWO interfaces - ethernet and WiFi. One OR the other at any one time.
Quis custodiet ipsos custodes?

User avatar
B.Goode
Posts: 16300
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 12:43 pm

drgeoff wrote: The OP wants to use TWO interfaces - ethernet and WiFi. One OR the other at any one time.
Maybe. If the search results are inappropriate they can be ignored.
Beware of the Leopard

a_bet
Posts: 8
Joined: Tue Dec 09, 2014 10:30 pm

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 12:51 pm

Thanks for the replies! I'm gonna try your hints as soon as I get home, anyway, just to be clear, all I want my Pi to do is the following :
- trying to connect via WIFI @ home -> static ip
- trying to connect via eth @ home -> static ip
- trying to connect to others network both via WIFI and eth - > dynamic ip

What's already achieved is this behavior while using wifi (through the configuration of the supplicant file), I wonder how I can reach the same via eth.

Again thanks for the replies

User avatar
DougieLawson
Posts: 42889
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 1:24 pm

Why do you think you need two connections to your home network? Which connection are you going to use for your gateway?

Rather than suggesting solutions you think you've come up with, why not state what problem you're trying to solve? Having more than one active network interface gets horribly complex very quickly.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
B.Goode
Posts: 16300
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 4:08 pm

A genuine question for the more knowledgable helpers here:

The enquirer says -
I configured the wpa_supplicant/wpa_supplicant.conf to set uo the wifi and it works pretty good, but I'd like to use the ethenet too when I need more speed.
later clarified as
trying to connect to others network both via WIFI and eth
So the aim is: "to use the ethenet too when I need more speed"

Not 'instead of', but 'as well as'.

So my question is: does defining 2 active network interfaces 'automagically' result in more speed?

My hunch is that it doesn't, but maybe the current IP stack on linux is smarter than I am expecting.
Last edited by B.Goode on Tue Dec 16, 2014 4:29 pm, edited 1 time in total.
Beware of the Leopard

User avatar
RaTTuS
Posts: 10829
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 4:24 pm

get your home router to issue you with a static IP while at home
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
DougieLawson
Posts: 42889
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 4:33 pm

B.Goode wrote:A genuine question for the more knowledgable helpers here:

The enquirer says -
I configured the wpa_supplicant/wpa_supplicant.conf to set uo the wifi and it works pretty good, but I'd like to use the ethenet too when I need more speed.
later clarified as
trying to connect to others network both via WIFI and eth
So the aim is: "to use the ethenet too when I need more speed"

Not 'instead of', but 'as well as'.

So my question is: does defining 2 active network interfaces 'automagically' result in more speed?

My hunch is that it doesn't, but maybe the current IP stack on linux is smarter than I am expecting.
https://wiki.debian.org/Bonding
Since both networks are on the same USB SMSC9514 controller chip it's not going to buy much speed.

When you have a desktop or a server with two independent PCI interface cards and a gigabit switch you may be able to get closer to two gigabits but on a RPi it's probably not going to buy anything and probably isn't worth the hassle.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
mikronauts
Posts: 2823
Joined: Sat Jan 05, 2013 7:28 pm

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 4:36 pm

DougieLawson wrote:Rather than suggesting solutions you think you've come up with, why not state what problem you're trying to solve?
+1e6
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

drgeoff
Posts: 14032
Joined: Wed Jan 25, 2012 6:39 pm

Re: Set Up Multiple Ethernet Networks with different static

Tue Dec 16, 2014 5:20 pm

Lots of guessing about what the OP really wants. I don't know for certain either but nothing of what he has written is unambiguous to me that he wants two interfaces active at the same time.

I can interpret his words " wifi and it works pretty good, but I'd like to use the ethenet too when I need more speed" as meaning that he would like to use ethernet in preference to Wi-Fi for its greater speed.

I can also interpret "connect to others network both via WIFI and eth" as meaning other networks which could be either WiFi or ethernet.

The only person who knows exactly what he wants is the OP. And even that might be doubtful. :)
Quis custodiet ipsos custodes?

a_bet
Posts: 8
Joined: Tue Dec 09, 2014 10:30 pm

Re: Set Up Multiple Ethernet Networks with different static

Thu Dec 18, 2014 10:17 am

I'm very sorry since it turned out I'm not clear.
I simply would like to know if the eth inferface would work whenever I try to connect to a network via eth BUT HAVING REMOVED the wifi dongle.
So actually I do not want to use the wifi and the eth at the same time, but just be able to use them (one per time) with static ip at home and with dynamic ip when I'm connecting to another network.
So, trying to reformulate my question, by having configured static ip (at home) for the eth interface, is there any chance to make it connect with dynamic ip when I'm not at home? So when I'm trying to connect to another network having the eth cable plugged in AND the wifi dongle unplugged?

I'm so sorry for the misunderstandings.

User avatar
DougieLawson
Posts: 42889
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Set Up Multiple Ethernet Networks with different static

Thu Dec 18, 2014 10:22 am

sudo apt-get install ifplugd

That, normally, useless pile of **** does exactly what you want. If you unplug the eth0 cable the WiFi sparks into life. If you connect the eth0 cable the WiFi is disabled.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
B.Goode
Posts: 16300
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Set Up Multiple Ethernet Networks with different static

Thu Dec 18, 2014 11:05 am

a_bet wrote: So actually I do not want to use the wifi and the eth at the same time, but just be able to use them (one per time) with static ip at home and with dynamic ip when I'm connecting to another network.
So, trying to reformulate my question, by having configured static ip (at home) for the eth interface, is there any chance to make it connect with dynamic ip when I'm not at home? So when I'm trying to connect to another network having the eth cable plugged in AND the wifi dongle unplugged?
An alternative solution. Configure your RPi to always use dhcp. Configure your home router to always hand out known IP addresses when your RPi - identified by its ethernet mac address or wifi adaptor mac address - connects to the home network. That way you have the best of both worlds: no change needed when taking the RPi elsewhere, but predictable IP addresses allocated when at home.
Beware of the Leopard

a_bet
Posts: 8
Joined: Tue Dec 09, 2014 10:30 pm

Re: Set Up Multiple Ethernet Networks with different static

Thu Dec 18, 2014 12:45 pm

@B.Good you nailed it! :)
I know I could configure the MAC address (1 for the eth interface and 1 fot the wlan I guess) , anyway I just wanted to know if it is possibile to have this behaviour without touching the router, by configuring only the Pi.
Anyway, thanks for the tip!

a_bet
Posts: 8
Joined: Tue Dec 09, 2014 10:30 pm

Re: Set Up Multiple Ethernet Networks with different static

Thu Dec 18, 2014 1:03 pm

DougieLawson wrote:sudo apt-get install ifplugd

That, normally, useless pile of **** does exactly what you want. If you unplug the eth0 cable the WiFi sparks into life. If you connect the eth0 cable the WiFi is disabled.
Thanks for the info, this could be helpful even is not what I need to do, in fact I don't need to have eth and wlan plugged in at the same time. My goal is to use them one at a time, but be able to have static ip at home and dynamic ip elsewhere: no matter if I'm using the eth (with the wifi dongle unplugged) or the wlan (with the eth cable unplugged).
Thanks

sg_industrialberry
Posts: 2
Joined: Wed Apr 05, 2017 6:31 pm

Re: Set Up Multiple Ethernet Networks with different static

Wed Apr 05, 2017 6:53 pm

Hi,

you can use EthernetBerry Dual Pi V 1.1 extension board for RaspBerry Pi.

EthernetBerry board has two functionalities: a dual Ethernet interface and an on board Real Time clock powered by a 12 mm battery. The Ethernet is based on ENC28J60 a SPI controller.

You can find all the info at http://www.industrialberry.com/ethernetberry-v-1-1/



Best Regards
Salvo
Attachments
ethernetberry.png
EthernetBerry
ethernetberry.png (61.18 KiB) Viewed 5589 times

Return to “Networking and servers”