LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ifup and ifdown commands don't work. (https://www.linuxquestions.org/questions/linux-newbie-8/ifup-and-ifdown-commands-dont-work-915696/)

venom4u31 11-26-2011 05:33 PM

ifup and ifdown commands don't work.
 
I'm running Debian 6. I have an interface named eth1 on it. I want to run ifup and ifdown on it because those are the only commands that access the interfaces file in /etc/network.

However, if the eth1 network is up:

when I run ifdown eth1 (eth1 is up) it displays:
Code:

ifdown: interface eth1 not configured
and none of the commands in the interfaces file are ran (not even those following down).

when I run ifdown --force eth1, it runs the down commands in the interfaces file, but it also displays the following message:
Code:

SIOCDELRT: No such process
and the network does not go down.

If the eth1 network is down:
when I run ifup eth1, the computer displays:
Code:

SIOCADDRT: No such process
Failed to bring up eth1.

. Also, none of the commands inside the interfaces file are ran.

when I run ifup --force eth1 it does the same thing.

Also I noticed that an interface called 5.0 appears when I run ifconfig after I run any of the ifup commands.

Can you tell me how to successfully run the ifup and the ifdown commands so that the instructions in the interfaces file may be ran accordingly?

aus9 11-26-2011 05:55 PM

hi

I have only one network device but suspect you have 2

lspci -v should show them.

2) do you have a file called /etc/network/interfaces?

this should show you how to up them?

venom4u31 11-26-2011 05:57 PM

Quote:

Originally Posted by aus9 (Post 4534784)
hi

I have only one network device but suspect you have 2

lspci -v should show them.

2) do you have a file called /etc/network/interfaces?

this should show you how to up them?

Yes, I have 2 networks. I also have eth0.

The /etc/network/interfaces file looks like this:
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 dhcp



#eth1

auto eth1
iface eth1 inet static
 address 10.5.10.200
 netmask 255.255.255.128
 gateway 255.255.255.129
 up date +"UP [%m-%d-%y/%H:%M:%S]" >> /var/log/file.log
 down date +"DOWN [%m-%d-%y/%H:%M:%S]" >> /var/log/file.log
 pre-up ifconfig eth1 hw ether aa:bb:cc:dd:05:0a
 down echo "hello world"


andywebsdale 11-26-2011 05:59 PM

I presume you're using the CLI, & not using any GUI stuff like Network Manager (or any other Gnome/KDE stuff)
Have you read the relevant bit of the Debian manual - here's a link to Debian Reference Manual - The Basic Network Configuration with ifupdown
First thing is to sanity check all the relevant config files. Hopefully the Reference will highlight what's wrong with your networking configuration
Your gateway looks weird to me - is that your gateway's address or am I not understanding something?
EDIT: Also that error message is shown if there are invalid addresses in the config file

ericson007 11-26-2011 06:16 PM

Not sure if this would solve the issue at hand, however, once I had a similar problem and had to use the ifconfig eth1 up command. This tended to work OK.

venom4u31 11-26-2011 06:19 PM

Quote:

Originally Posted by andywebsdale (Post 4534788)
I presume you're using the CLI, & not using any GUI stuff like Network Manager (or any other Gnome/KDE stuff)
Have you read the relevant bit of the Debian manual - here's a link to Debian Reference Manual - The Basic Network Configuration with ifupdown
First thing is to sanity check all the relevant config files. Hopefully the Reference will highlight what's wrong with your networking configuration
Your gateway looks weird to me - is that your gateway's address or am I not understanding something?
EDIT: Also that error message is shown if there are invalid addresses in the config file

I've read the reference, but I don't think it helps me. Ifdown and ifup work just fine on eth0, but on eth1 they don't work at all...

andywebsdale 11-26-2011 06:27 PM

Have another look at your gateway address - it isn't valid, that's why you're getting error messages & its bombing out
It should be an address that exists either on the public internet or as a private address using the reserved address spaces.

Brains 11-26-2011 06:48 PM

I recently tried to connect to a wireless ap from command line using ifconfig and iwconfig and the last command to get connected, dhclient eth1. It never worked this way, from command line Debian wiki says you need to configure the interfaces file. But just configuring it does not get me connected, running the dhclient command has the interfaces file processed and a connection is established via dhcp. I would think the router needs to be configured to use dhcp.

venom4u31 11-27-2011 02:43 AM

Quote:

Originally Posted by andywebsdale (Post 4534815)
Have another look at your gateway address - it isn't valid, that's why you're getting error messages & its bombing out
It should be an address that exists either on the public internet or as a private address using the reserved address spaces.

I used a subnet calculator and determined that my default gateway should be like this: 10.5.10.129 (first usable address).

Now my interfaces file looks like this, but it does not have any effect:
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 dhcp



#eth1

auto eth1
iface eth1 inet static
 address 10.5.10.200
 netmask 255.255.255.128
 gateway 10.5.10.129
 up date +"UP [%m-%d-%y/%H:%M:%S]" >> /var/log/file.log
 down date +"DOWN [%m-%d-%y/%H:%M:%S]" >> /var/log/file.log
 pre-up ifconfig eth1 hw ether aa:bb:cc:dd:05:0a
 down echo "hello world"

ifup and ifdown still do not work.

andywebsdale 11-27-2011 11:41 AM

Have you tried using the /sbin/ifconfig command to configure eth1 - it might give you a more explanatory error message. Also, when you boot, as eth1 is set to auto, the errors should be logged in /var/log depending on your logging setup, & they might be able to tell you something.
The gateway address is normally the address of your router or another machine that is the "gateway" to the network, i.e another network or the internet i.e the route that you want traffic to take when as address isn't on the local network(e.g. an internet address).
What exactly are you aiming at with this network config? If eth1 is connected to the 10.5.10.128/25 network & the plan is that traffic from the 10.5.10.128/25 is connected to the internet through this machine, perhaps with filtering, then eth1 doesn't need a gateway address at all & the other PCs on the 10.5.10.128/25 network will use 10.5.10.200 as their gateway.
A network that notwork can be very frustrating, I know... :)

venom4u31 11-27-2011 11:44 AM

Quote:

Originally Posted by andywebsdale (Post 4535360)
Have you tried using the /sbin/ifconfig command to configure eth1 - it might give you a more explanatory error message. Also, when you boot, as eth1 is set to auto, the errors should be logged in /var/log depending on your logging setup, & they might be able to tell you something.
The gateway address is normally the address of your router or another machine that is the "gateway" to the network, i.e another network or the internet i.e the route that you want traffic to take when as address isn't on the local network(e.g. an internet address).
What exactly are you aiming at with this network config? If eth1 is connected to the 10.5.10.128/25 network & the plan is that traffic from the 10.5.10.128/25 is connected to the internet through this machine, perhaps with filtering, then eth1 doesn't need a gateway address at all & the other PCs on the 10.5.10.128/25 network will use 10.5.10.200 as their gateway.
A network that notwork can be very frustrating, I know... :)

You have a point there...


I solved the problem: eth1 should not be configured the auto. Deleting or commenting "auto eth1" solved the whole thing.

Yes, it's very frustrating, I use ip or ifconfig... However they don't execute the required scrips, so I'm stuck with ifup and ifdown that succede the other commands (which means that if a network or interface is downed or upped by ifconfig, for example, ifup or ifdown won't have any effect on it).

andywebsdale 11-27-2011 11:50 AM

Pleased to hear that you've solved it - I take your point about scripting.


All times are GMT -5. The time now is 05:42 AM.