PDA

View Full Version : [ubuntu] Networking issue



U2XS
November 15th, 2009, 08:22 PM
I've installed an Ubuntu Server on one computer and then I've removed the hard drive from that computer and placed it into another. This new computer has an additional NIC, which I use rather than the one of the motherboard.


I am able to SSh into the computer, which is good. But once inside, commands that require internet use fail. So "sudo apt-get update" fails every download. Or Whois Ubuntu.com fails as well.

I imagine that the issue is that the NIC is not properly configured. From the GUI, it's always been very easy if not automatic. I don't know where to start from SSh though. Any ideas?

Iowan
November 15th, 2009, 08:39 PM
Check route to see if the other NIC is still the default.

U2XS
November 15th, 2009, 08:46 PM
Maybe you gave me too much credit. I don't know how to interpret this.

root@server:/home/administrator# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.20.0 * 255.255.255.0 U 1 0 0 eth1
link-local * 255.255.0.0 U 1000 0 0 eth1
default 192.168.20.1 0.0.0.0 UG 0 0 0 eth1

Iowan
November 15th, 2009, 08:52 PM
In hindsight, it occurs to me that if route were messed up, you probably wouldn't be able to SSH into the machine. Can you ping internet sites by name or IP?

U2XS
November 15th, 2009, 09:00 PM
I tried pinging Google's IP, but was not successful.

root@server:/home/administrator# ping 216.239.51.99
PING 216.239.51.99 (216.239.51.99) 56(84) bytes of data.
^C
--- 216.239.51.99 ping statistics ---
8 packets transmitted, 0 received, 100% packet loss, time 7056ms

Iowan
November 15th, 2009, 09:08 PM
That address didn't work for me - 74.125.53.100 did.

U2XS
November 15th, 2009, 10:28 PM
Ok, the Ping with that IP was successful. I guess that's good, but what does it mean?

Iowan
November 16th, 2009, 03:35 AM
If you can ping by IP address but not by name, then DNS may be at fault. Check /etc/resolv.conf to see if you have valid nameservers listed there.

U2XS
November 16th, 2009, 06:54 AM
Ahh, we might have found the problem. The file is almost entirely empty with the exception of the caption


# Generated by NetworkManager

I'll be able to log into the computer in person tomorrow. I can use the function in the grub that automatically corrects network issues. Do you think that will help?

dineshs
November 16th, 2009, 07:00 AM
Try editing the /etc/resolv.conf file by adding this line.
nameserver 4.2.2.1

U2XS
November 16th, 2009, 07:42 AM
Hmm, no luck. I've rebooted the computer after saving, but it didn't help. I then tried to restart the network and the following output might be helpful.


administrator@server:~$ sudo /etc/init.d/networking restart
* Reconfiguring network interfaces... Ignoring unknown interface eth1=eth1.
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
SIOCSIFBRDADDR: No such device
eth0: ERROR while getting interface flags: No such device
eth0: ERROR while getting interface flags: No such device
Failed to bring up eth0.

dineshs
November 16th, 2009, 07:49 AM
please post the output of the following

ping 64.233.189.104

and

sudo gedit /etc/resolv.conf

U2XS
November 16th, 2009, 08:02 AM
The ping was successful


administrator@server:~$ ping 64.233.189.104
PING 64.233.189.104 (64.233.189.104) 56(84) bytes of data.
64 bytes from 64.233.189.104: icmp_seq=1 ttl=241 time=221 ms
64 bytes from 64.233.189.104: icmp_seq=2 ttl=241 time=240 ms
64 bytes from 64.233.189.104: icmp_seq=3 ttl=241 time=220 ms
64 bytes from 64.233.189.104: icmp_seq=4 ttl=241 time=219 ms
^C
--- 64.233.189.104 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 219.117/225.433/240.658/8.836 ms

/etc/resolv.conf

# Generated by NetworkManager

Very similar to what we did before. Even though I added "nameserver 4.2.2.1", it is not there after rebooting

dineshs
November 16th, 2009, 08:17 AM
I am not an expert , but I believe that a reboot should not change the file if you had saved it .Can you try configuring DNS via GUI by going to System-Administration-Network ?

Iowan
November 17th, 2009, 01:01 AM
Does that machine have Network Manager? A server generally doesn't... unless you've added a desktop. Also, does the machine have static address, DHCP address, or static lease from DHCP server? If it uses DHCP to get address or static lease, you can use /etc/dhclient.conf to "prepend" DNS server(s) of your choice.

U2XS
November 18th, 2009, 12:06 AM
Try editing the /etc/resolv.conf file by adding this line.
nameserver 4.2.2.1
It turns out that this was key! It's odd, but I have to insert it and then - without rebooting, I have to use the following commands


sudo /etc/init.d/networking stop
then

sudo /etc/init.d/networking start


The following command would appear to be more logical but it always produces an error message.

sudo /etc/init.d/networking restart