3

I'm preparing to move and took down two of my servers, leaving only one with some essential services running. What I neglected to consider was that one was the DHCP server(which I realized when somebody contacted me saying they couldn't connect. Whups). So because I only have a few hosts on this small network, I opted to just statically configure them for now. One of these is a new Ubuntu 11.04 server, where I have very little experience.

I edited /etc/network/interfaces and /etc/hosts to reflect my changes.

I ran

$sudo /etc/init.d/networking stop
 *deconfiguring network interfaces ...

So yay. Then I try to start, it gives me the mumbo jumbo about using services (why didn't it do that for the stop?) So instead I run ...

$sudo service networking start
networking stop/waiting

Now, to me that says the status of the service is stopped. But when I ping another computer, I get a successful reply. So is it not actually stopped? More importantly, am I doing something wrong?

Edit

daniel@FOOBAR:~$ sudo service networking status
networking stop/waiting

daniel@FOOBAR:~$ sudo service networking stop
stop: Unknown instance:

daniel@FOOBAR:~$ sudo service networking status
networking stop/waiting

daniel@FOOBAR:~$ sudo service networking start
networking stop/waiting

daniel@FOOBAR:~$ sudo service networking status
networking stop/waiting

So you can see why I ran /etc/init.d/networking stop instead. For some reason upstart (that is what "services" is, right?) isn't working with stop.

cat /etc/hosts

127.0.0.1       localhost
127.0.1.1       FOOBAR
198.3.9.2       FOOBAR #Added entry July 19 2011

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

cat /etc/network/interfaces

# 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
#auto eth0
#iface eth0 inet dhcp
#       hostname FOOBAR

auto eth0
iface eth0 inet static
        address 198.3.9.2
        netmask 255.255.255.0
        network 198.3.9.0
        broadcast 198.3.9.255
        gateway 198.3.9.15

No I didn't save backups, it was just a minor change so I just commented out the old DHCP setting.

Edit I set everything back to original settings and set up a DHCP server. "starting" networking does the same thing. I can only assume this is normal, I just don't know WHY. It can't be anything to do with the configuration files, since they've been restored.

Daniel B.
  • 725
  • 1
  • 7
  • 16

2 Answers2

1

Use /sbin/ifconfig to see what your current networking state is.

Use /sbin/ifup <name> to bring up an interface defined in /etc/network/interfaces. Likewise use /sbin/ifdown <name> to bring the interface down.


If the actual state of the interface is different from that of ifconfig do the following:

DO NOT DO THIS OVER THE NETWORK. DO THIS FROM THE CONSOLE. IF YOU LOSE ACCESS TO YOUR BOX YOUR BLOOD IS ON YOUR OWN HEAD.

  1. Clear the entry from /etc/network/run/ifstate.
  2. For each IP on that interface run /sbin/ip addr del 1.2.3.4/24 dev eth0 (obviously using the appropriate IP & interface name).
  3. For the interface itself run /sbin/ip link set eth0 down (again, using the appropriate interface name).

After this is done you should be able to cleanly use /sbin/ifup <name> to bring the interface up.

bahamat
  • 6,433
1

try

sudo service network-interface restart INTERFACE=eth0

edit the command to use your interface instead of eth0 if necessary.

(I've checked mine with ifconfig, but mine is up.)

source: http://ubuntuforums.org/showthread.php?t=1706192

n611x007
  • 127