-
- Posts: 4
- Joined: Sun Apr 15, 2018 6:16 am
/etc/network/interfaces in Raspbian Stretch
Hello, I would like to ask. Is there any way to use /etc/network/interfaces in stretch? I'm trying to setup static ip for several interfaces and setting up ad-hoc as well. It was kinda easy to do in old wheezy or jessie.
Re: /etc/network/interfaces in Raspbian Stretch
Yes; just do it. People will say that's not the way to do it but if it works, achieves what you want, then job done.billgufran wrote: ↑Sun Apr 29, 2018 1:50 pmIs there any way to use /etc/network/interfaces in stretch?
It is what I have done to achieve multiple static IP addresses on my Pi on different subnets because suggestions for 'doing it properly' failed to achieve the desired results. I invested hours of time in trying to make it work 'the proper way'. A 30 second edit of /etc/network/interfaces did the job just fine.
- DougieLawson
- Posts: 42155
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: /etc/network/interfaces in Raspbian Stretch
If you're going to use /etc/network/interfaces then you need to add a
ororor line into /etc/dhcpcd.conf to avoid getting two DHCP addreses (or one static and one DHCP address) assigned to the interface.
Code: Select all
denyinterfaces eth0
Code: Select all
denyinterfaces wlan0
Code: Select all
denyinterfaces enxb827ebbecafe
Code: Select all
denyinterfaces wlxdeadbeefcafe
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.
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.
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6383
- Joined: Fri Jul 29, 2011 5:36 pm
Re: /etc/network/interfaces in Raspbian Stretch
dhcpcd won't start if you have configured /etc/network/interfaces
The most common mistake people make in the interfaces file is forgetting the 'auto eth0' line.
The only downside is that the default desktop is not set up for it, which shouldn't be a problem for people who use ifupdown.
The most common mistake people make in the interfaces file is forgetting the 'auto eth0' line.
The only downside is that the default desktop is not set up for it, which shouldn't be a problem for people who use ifupdown.
Re: /etc/network/interfaces in Raspbian Stretch
You can (sort of) have static IP addresses for multiple networks with DHCP too.
Create a file /etc/dhcpcd.exit-hook containing something like this This sets up a second, static alias IP for whichever network you are connected to.
It's best to choose a static IP that's not going to be allocated by DHCP on the router.
I have not tried this with Stretch but it worked with Jessie.
Create a file /etc/dhcpcd.exit-hook containing something like this
Code: Select all
aliasip=
if $if_up; then
# Wireless alias
case "$ifssid" in
EE-BrightBox-abcdef) aliasip="192.168.1.142/24";;
MyOffice) aliasip="10.10.10.142/24";;
esac
# Ethernet alias
case "$interface" in
eth0) aliasip="192.168.1.148/24";;
esac
if [ -n "$aliasip" ]; then
echo "Adding alias of $aliasip to $interface"
ip a a "$aliasip" dev "$interface"
fi
fi
It's best to choose a static IP that's not going to be allocated by DHCP on the router.
I have not tried this with Stretch but it worked with Jessie.
Re: /etc/network/interfaces in Raspbian Stretch
hello @billgufran i am trying to do the same thing with several raspberry 3 B+ and raspberry pi zero w.billgufran wrote: ↑Sun Apr 29, 2018 1:50 pmHello, I would like to ask. Is there any way to use /etc/network/interfaces in stretch? I'm trying to setup static ip for several interfaces and setting up ad-hoc as well. It was kinda easy to do in old wheezy or jessie.
i tried the following command for switching wlan0 to ad-hoc
Code: Select all
sudo iw wlan0 set type ibss
Code: Select all
pi@rpizero1:~ $ sudo iw wlan0 set type ibss
command failed: Device or resource busy (-16)
Re: /etc/network/interfaces in Raspbian Stretch
Currently i am writing some tutorials on how to create a mqtt adhoc mesh cluster network with several raspberry pi 3 b+ and zero w.
My script uses the ip and iw commands for creating the adhoc network which work on the newest Raspbian Stretch version.
So everybody who is interested in using adhoc and batman on a raspberry pi with the newest raspbian (2018-04-18) just give it a try:
Link to my github tutorial on how to install and configure batman-adv on a raspberrypi:
https://github.com/suiluj/pi-adhoc-mqtt ... and-batctl
Hint:
If you do not want to use batman-adv (really cool software to create an adhoc mesh) just ignore the batman parts.
My script uses the ip and iw commands for creating the adhoc network which work on the newest Raspbian Stretch version.
So everybody who is interested in using adhoc and batman on a raspberry pi with the newest raspbian (2018-04-18) just give it a try:
Link to my github tutorial on how to install and configure batman-adv on a raspberrypi:
https://github.com/suiluj/pi-adhoc-mqtt ... and-batctl
Hint:
If you do not want to use batman-adv (really cool software to create an adhoc mesh) just ignore the batman parts.
-
- Posts: 4
- Joined: Sun Apr 15, 2018 6:16 am
Re: /etc/network/interfaces in Raspbian Stretch
suiluj wrote: ↑Fri May 18, 2018 4:54 pmCurrently i am writing some tutorials on how to create a mqtt adhoc mesh cluster network with several raspberry pi 3 b+ and zero w.
My script uses the ip and iw commands for creating the adhoc network which work on the newest Raspbian Stretch version.
So everybody who is interested in using adhoc and batman on a raspberry pi with the newest raspbian (2018-04-18) just give it a try:
Link to my github tutorial on how to install and configure batman-adv on a raspberrypi:
https://github.com/suiluj/pi-adhoc-mqtt ... and-batctl
Hint:
If you do not want to use batman-adv (really cool software to create an adhoc mesh) just ignore the batman parts.
Hey thank you so much for the guide! It's really helpful. But I actually trying to make Batman meshnode with bridge (like the option 2 from your Batman Adv and Batctl guide) between wlan0 (adhoc interface) and wlan1 (usb wifi), where wlan1 act as wifi client and hotspot at the same time. So principally, the wifi client of wlan1 hotspot will get access to adhoc network. I'm not sure if it's possible or not, I guess I'll just do some trial and error based on your guides.