Posts Tagged networking

Ubuntu networking bug updating to Jaunty

Posted by on Thursday, 10 September, 2009

We had a customer email in after updating to Jaunty recently. They said the following

Hi guys, I upgraded my VPS a little while back to Ubuntu Jaunty (because I was several versions out of date and the apt repositories had gone away.) I never actually rebooted the machine afterwards though because it wasn’t a good time to potentially interrupt email. I finally got around to doing that, and the VPS won’t come back onto the network. Logging in over the console, it looks like there are no network interfaces configured. A few other things don’t feel right (eg, dmesg tells me that the current tls library or perhaps libc isn’t xen-friendly.) but mostly everything *looks* like it’s ok but doesn’t have a network interface.. services that want to resolve hostnames didn’t start up, etc. Trying to dig into the problem, it looks like there are no modules installed for the kernel, but this is where my expertise runs out.. I don’t know enough about Xen to know if everything was just precompiled into the kernel, or if I blew away my kernel modules during upgrade.

I was curious so logged in via the console .

I ran ifup and got the following errors

root@charon ~ # ifup eth0
ifup: failed to open statefile /var/run/network/ifstate: No such file or directory

so i checked and /var/run/network did not exist. I fixed this

root@charon network # mkdir /var/run/network/
root@charon network # ifup eth0
* if-up.d/mountnfs[eth0]: waiting for interface lo before doing NFS mounts
root@charon network # ifconfig
eth0 Link encap:Ethernet HWaddr aa:00:d6:a1:5e:e4
inet addr:72.33.222.111 Bcast:72.29.222.255 Mask:255.255.255.128
inet6 addr: fe80::a800:d6ff:fea1:5ee4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:56 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5447 (5.4 KB) TX bytes:1074 (1.0 KB)

The file system on Ubuntu in /var/run is a virtual filesystem on Ubuntu, I googled and came across this post here https://bugs.launchpad.net/ubuntu/+bug/367171 which clearly logs the bug, and a fix.

The fix i applied which was adding the following into /etc/init.d/networking

[ -d /var/run/network ] || mkdir -p /var/run/network

This checks if the dir exists and creates it if it doesn’t.

This does fix the problem but its a bit of a hack. I noticed a link later on down the post which took me to https://bugs.launchpad.net/ubuntu/+bug/377432 . This link had a bit more technical information. They said look for the following files and remove them.

/etc/udev/rules.d/85-ifupdown.rules

/lib/udev/rules.d/85-ifupdown.rules


Linux Networking

Posted by on Tuesday, 7 April, 2009

OK Quick and dirty here.
If unsure of your network card you need to do

lspci

This will spit a lot of crap that looks like

0000:00:00.0 Host bridge: ATI Technologies Inc RS200/RS200M AGP Bridge [IGP 340M] (rev 02)
0000:00:01.0 PCI bridge: ATI Technologies Inc PCI Bridge [IGP 340M]
0000:00:02.0 USB Controller: ALi Corporation USB 1.1 Controller (rev 03)
0000:00:06.0 Multimedia audio controller: ALi Corporation M5451 PCI AC-Link Controller Audio Device (rev 02)
0000:00:07.0 ISA bridge: ALi Corporation M1533 PCI to ISA Bridge [Aladdin IV]
0000:00:08.0 Modem: ALi Corporation M5457 AC'97 Modem Controller
0000:00:0a.0 CardBus bridge: O2 Micro, Inc. OZ6912 Cardbus Controller
0000:00:0c.0 FireWire (IEEE 1394): Texas Instruments TSB43AB21 IEEE-1394a-2000 Controller (PHY/Link)
0000:00:10.0 IDE interface: ALi Corporation M5229 IDE (rev c4)
0000:00:11.0 Bridge: ALi Corporation M7101 Power Management Controller [PMU]
0000:00:12.0 Ethernet controller: National Semiconductor Corporation DP83815 (MacPhyter) Ethernet Controller
0000:01:05.0 VGA compatible controller: ATI Technologies Inc Radeon IGP 340M

Most of this isnt really needed, just look for the line that refers to Ethernet or network controller like this

0000:00:12.0 Ethernet controller: National Semiconductor Corporation DP83815 (MacPhyter) Ethernet Controller

Now you need to find the module for that network card driver, a list of available modules are found like this

ls /lib/modules/`uname -r`/kernel/drivers/net/

When you probe a module/driver you need to leave off the .ko or .o at the end so it looks like this

modprobe natsemi

natsemi is the driver i need for my national semiconductor network card. If its sucessful then it will either exit cleanly or give you a message, if it errors then try another one.
to find out system messages you can run

dmesg

This is verbose but you only really need to pay attention to the last few lines really to see if it found your network card.
Once this is sucessful you need to give that network card an IP

ifconfig eth0 10.40.1.7

This will set the ip of the interface eth0 to 10.40.1.7. Feel free to use another ip 🙂
You can view the network status with

ifconfig eth0
inet addr will hold the magical IP number.
Now to add a default route to use the gateway.

route add default gw 10.40.1.254

This adds the ip 10.40.1.254 as my default route/gateway.
You can view the default routes by typing

route -n

Now to set up DNS resolving.
Find your favourite editor (probably nano,pico,joe.mcedit for newbies) and edit /etc/resolv.conf
Note: its resolv.conf NOT resolve.conf (that e can leave you in a world of pain if you add it in 🙂 )

It should look something like this

nameserver 219.88.241.110
nameserver 210.55.12.1

Now feel free to use my nameserver (the first) and im fairly sure Orcon (the second IP) dont mind you using theirs, however its probably a good idea to call your ISP and ask the ip of their nameservers and use theirs.

You should have working internet access at this point in time.
Now as soon as you reboot your settings will be gone (except for resolv.conf)
Most distros of Linux have a place to keep these, and each distro its a different one.
Debian based systems:
edit /etc/modules and at the bottom add in a single name of the module you used that work
ie
natsemi
This will now load on boot.
for network you would edit /etc/network/interfaces
it should look something like this

auto lo eth0
iface lo inet loopback
iface eth0 inet static
address 10.40.1.7
netmask 255.255.255.0
broadcast 10.40.1.255
gateway 10.40.1.254

The auto means that its loaded automaticly on boot, lo is localhost/loopback.
Use your own ips and network settings.

Redhat based systems generally have network in /etc/sysconfig/ somewhere (been a while since i used them)

Other systems use other methods but generally all keep the config settings in /etc somewhere.

Last-Modified: 2007-03-07 19:38:50