Originally posted by: Shawn
You are not connected properly to the internet.
Maybe maybe not. Don't jump to conclusions, it could be something else.
If your not familar with 'vi' then don't bother using it. It's for advanced Linux users and not people who aren't already familar with 'vi'.
Vi is a throwback to the ancient ancient days of Unix. It's safe to ignore it at this point. If your interested in learning it then one of Ubuntu's packages will have a program called 'vimtutor'. Maybe with vim-common package, I am not sure about ubuntu.
But what you'd like to use for text editing in the beginning is nano.
Nano is much easier to use. Use it by going:
> nano text-file.txt
And you'll notice at the bottom there are various ^C or ^X and such keys. The ^ in this program means 'ctrl' key. So those are combos like ctrl-C or ctrl-X.
This is different between things like Fedora vs Ubuntu.. But Ubuntu and Debian have the same configuration files.
For doing a static configuration you need to check several files:
/etc/network/interfaces -- stores the configuration for network interfaces
/etc/resolv.conf -- stores the DNS server information.
/etc/hosts -- hostname information.
The 2 important ones are the interfaces and the resolve.conf.
The person's example is:
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
for the Eth0 network interface.
that is pretty good.
All you need is this though:
iface eth0 inet static
address 192.168.0.20
netmask 255.255.255.0
gateway 192.168.0.254
The network address and the broadcast address can be both calculated very easily by the netmask and address. So you can delete the other entries. The address, netmask, and gateway are all required entries.
You can learn more about the interfaces files by going 'man interfaces'. Also they have a couple examples.
Note that if your using wireless connections then things get much more complex.
AFter editing the configuration file then the commands to take down and bring up the interfaces are:
sudo ifdown eth0
sudo ifup eth0
Note that some computers have more then one eth# interface. If you still have problems go:
sudo ifconfig -a |less
And see if you have multiple eth0 interfaces. Sometimes firewire ports will show up as network interfaces since you can do limited networking with them.
The second important file is /etc/resolv.conf
This file is for DNS configuration.
It's syntax goes like this:
search domain.com
nameserver 192.168.0.1
nameserver 192.168.0.2
The 'search' line is not very important for home users. It's used for networks were you have real domain names. But otherwise it doesn't realy matter
The nameservers are the ip addresses for your DNS servers. This is very important. Also you can have multiple DNS servers entered there. The computer will try them in the order of they are listed.
Howto troubleshoot network issues:
Lets assume that your network interface is eth0 and that the configuration is:
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.254
and then:
nameserver 192.168.0.1
Substitute your own correct addresses.
Also with the ping command... If you run it it will run forever. After a while you can hit the ctrl-c button combo to kill the ping. This is normal. Let it give you at least 10 good pings. Sometimes network problems.
first, basic networking test. Steps that you have to do and descriptions of the problem is if they fail:
_make_sure_you_run_these_steps_in_order_. If you skip around it will make it harder to figure out what is going on.
1: basic network test. If this fails you have issues.
> ping 127.0.0.1
If that fails then try:
> ifup lo
and try again. Many programs will not function properly without this working, even if they aren't accessing a network.
2: ping your own ip address
> ping 192.168.0.10
If that fails then your network interface is not up or is not configured correctly. Try:
> sudo ifdown eth0
> sudo ifup eth0
And try it again. If it fails check out your /etc/network/interfaces configuration file and run:
> sudo ifconfig eth0
to see the actual current configuration. Could be driver issues.
3. Ping gateway.
> ping 192.168.0.254
If this fails you need to check your wires. Could be the switch is bad or turned off or disconnected. Could be the wire is bad. Could be you have the wire plugged into the wrong port.
4. ping DNS server.
> ping 192.168.0.1
If this fails then your DNS server could be down. Check to make sure that it's properly configured and you ahve the correct IP address.
Also if the DNS server is not on the same network as you (like a DNS server provided by the ISP that is on the internet) then you routing information could be misconfigured. See the descryption after the following command to see how to check for that.
5. ping internet ip address. This is one of google's addresses:
64.233.187.99
Other ones to try are:
216.109.112.135
83.138.189.100
Keep in mind that some servers have ping disabled. But those addresses should be fine. The command is, obviously:
> ping 64.233.187.99
If that fails, and other addresses fail, then your gateway is probably not setup correctly. Make sure you can still ping your gateway.
> ping 192.168.0.254
Check to see if routing information is still setup correctly:
> sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.254 0.0.0.0 UG 0 0 0 eth0
If it is incorrect then check your /etc/network/interfaces file to make sure that is correct and run:
> sudo ifdown eth0
> sudo ifup eth0
Then re-run
> sudo route -n
And it should be correct.
If you still can't ping the external address then maybe your internet connection is down. Double check that.
6. Ping a internet server using Domain name:
> ping
www.google.com
It may take up to a few seconds to fail. Just wait until it comes back with a error. Sometimes that error can be very usefull in determining the problem.
If this doesn't work then your DNS server is not working correctly. Check it's configuration or use a different DNS server and see if the other one works better.
If all those commands work then your network should be fully functional and correctly configured.
Hope that helps.