DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a debian box that seems to have lost iface. iface returns command not found, I can't find it anywhere, and my environment is default. I've edited the /etc/network/interface file a ton and no change is ever reflected either through reboots, nor network restarts. When my box reboots, I have to log into the console to set the ip address and routes like so:
ip addr add 192.168.12.35/24 brd + dev eth0
route add default gw 192.168.35.1 eth0
What I'd like to do is one of two things. Add a startup script to run these commands on boot, or figure out what the hack happened to iface. Either solution would be helpful. I've read this page in init.d scripts, but can't really figure out where to add thise two commands: https://mkaz.com/2013/07/03/run-scri...art-on-debian/
I already tried putting those two commands in a bash script called 'ipassignment' in /etc/init.d, then running 'update-rc.d ipassignment defaults'. I tested with a reboot and it just reported as failed. It also had warning during the 'update-rc.d ipassignment defaults' command I assume because I had no call for {start|stop} in the script. I can't reboot that server right now, but when I can I'll grab a screenshot. Running the script itself works, but on boot it failed. Nice catch on the IP addresses as well, I just inserted random numbers insted of the real subnets.
I don't know what you are talking about with your reference to "iface". If you want a static network interface in debian you don't need to write any scripts, instead you put a few lines in your /etc/network/interfaces file. For example it looks like you want:
Code:
auto eth0
iface eth0 inet static
address 192.168.12.35
gateway 192.168.35.1
The "auto eth0" line will ensure the interface is bought up at boot. You can manually start and stop it with "ifup eth0" and "ifdown eth0".
I'll give this a shot. As far as I can tell I do have my interface configured correctly, however changes I make to the /etc/networking/interfaces file are never reflected. Regardless of system reboot or stopping and starting the networking service, it never works, on either interface. If I use the two commands posted in my first post, I can manipulate the interfaces with no issue. Unless "eth0" and "eth1" aren't the correct identifiers, then I'm at a loss.
I'll give this a shot. As far as I can tell I do have my interface configured correctly, however changes I make to the /etc/networking/interfaces file are never reflected.
Debian does not use that file. You need to edit /etc/network/interfaces.
Quote:
Originally Posted by baconisbetter
Regardless of system reboot or stopping and starting the networking service, it never works, on either interface.
What "networking service". Perhaps you are thinking of RHEL based systems?
Quote:
Originally Posted by baconisbetter
If I use the two commands posted in my first post, I can manipulate the interfaces with no issue. Unless "eth0" and "eth1" aren't the correct identifiers, then I'm at a loss.
You are using a Debian system, so please use the infrastructure it provides. To see what interfaces you have use:
Debian does not use that file. You need to edit /etc/network/interfaces.
My mistake on the typo, it is /etc/network/interfaces that im editing with no reflected change.
Quote:
What "networking service". Perhaps you are thinking of RHEL based systems?
I do generally work in RHEL systems, so what i mean is if i do this:
Code:
/etc/init.d/networking start/stop
Does this not restart the network service? since I use the word 'networking' in the command, so I called it the 'networking service', what should I call it?
Quote:
You are using a Debian system, so please use the infrastructure it provides. To see what interfaces you have use:
Code:
ifconfig -a
I try to but it does nothing. In fact, I can use ifconfig to assign an address to either eth0 or eth1, but it fails to pick up anything in /etc/network/interfaces. here is my ifconfig output:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth1 inet static
address 192.168.12.35
netmask 255.255.255.0
network 192.168.12.0
broadcast 192.168.12.255
gateway 192.168.12.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.25.118 192.168.26.203
dns-search co.int
allow-hotplug eth1
iface eth1 inet static
address 192.168.25.21
netmask 255.255.255.0
network 192.168.25.0
broadcast 192.168.25.255
gateway 192.168.25.2
dns-nameservers 192.168.25.118 192.168.26.203
dns-search co.int
Now, if i reboot, or do a '/etc/init.d/networking stop/start', both interfaces come back with NO ip address, and the system has no default route until I log onto the console and do:
Code:
ip addr add 192.168.12.35/24 brd + dev eth0
route add default gw 192.168.12.1 eth0
that's another typo. I was going through the post checking it all and changed that think it was wrong and just logged back into the server thinking I'd found something. the one on the server is:
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.12.35
netmask 255.255.255.0
network 192.168.12.0
broadcast 192.168.12.255
gateway 192.168.12.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.25.118 192.168.26.203
dns-search co.int
allow-hotplug eth1
iface eth1 inet static
address 192.168.25.21
netmask 255.255.255.0
network 192.168.25.0
broadcast 192.168.25.255
gateway 192.168.25.2
dns-nameservers 192.168.25.118 192.168.26.203
dns-search co.int
I also have a backup file I;ve tried to use several times that doesn't even have a eth1 section:
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.12.35
netmask 255.255.255.0
network 192.168.12.0
broadcast 192.168.12.255
gateway 192.168.12.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.25.118 192.168.26.203
dns-search co.int
this is because this host is a vm and I can add and remove NIC cards easily. When nothing was working i added the NIC eth1 for testing.
sorry for the confusion. I also have another one that is strictly for eth1 as a test. none work.
I do generally work in RHEL systems, so what i mean is if i do this:
Code:
/etc/init.d/networking start/stop
Does this not restart the network service? since I use the word 'networking' in the command, so I called it the 'networking service', what should I call it?
Running that with the "start" argument will run "ifup -a" which will call "ifup ethX" for every "ethX" that is marked as "auto" in the interfaces file. This is why I said to run "ifup eth0" If you had have done that I think you would have gotten an error message indicating the problem with your interfaces file (as in my previous post). With the "stop" argument it runs "ifdown -a" which runs "ifdown ethX" for all interfaces marke auto.
Note also that you have not defined your interfaces as auto (you have allow-hotplug).
aah I see. OK I don't have console access to this server right now, only ssh, so I'll try this first thing tomorrow when I'm near it again. thanks very much. will the error be verbose or will it be in /var/log/messages?
aah I see. OK I don't have console access to this server right now, only ssh, so I'll try this first thing tomorrow when I'm near it again. thanks very much. will the error be verbose or will it be in /var/log/messages?
Since you said that having two eth1 sections and no eth0 section was just a typo in your post, there probably won't be an error. You just need to run "ifup eth0" and "ifup eth1" to start the networking. To have the interfaces come up by running "/etc/init.d/networking start" (and therefore automatically at boot) you should replace the "allow-hotplug ethX" lines with "auto ethX".
I made the changes but it didn't work. We ended up reinstalling a package called netbase to get things working. Thanks for all the help! I did leave the lines at "auto eth0" however.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.