The basics for any network based on *nix hosts is the Transport Control Protocol/ Internet Protocol (TCP/IP) combination of three protocols. This combination consists of the Internet Protocol (IP),Transport Control Protocol (TCP), and Universal Datagram Protocol (UDP).
By Default most of the users configure their network card during the installation of Ubuntu. You can however, use the ifconfig command at the shell prompt or Ubuntu’s graphical network configuration tools, such as network-admin, to edit your system’s network device information or to add or remove network devices on your system
Configuring Network Using Graphical Configuration Tool in Ubuntu
If you are new to networking the graphical configuration tool is your best method for configuring new hardware in Ubuntu.We are going to use GUI tool “network-admin” to configure networking. Remember, you must be root to run network-admin.
There are two ways to start network-admin first thing is you can use your terminal to type “sudo network-admin” it will start up or you can go to System—>Administration —>Networking
Once it opens you should see the following screen
In the above screen select wired connection and click on properties tab you should see the following screen my network card is curretly configured for DHCP client and you need to make sure “Enable this connection” tick box is checked
If you want to configure the Static ipaddress you need to select drop down box under “Configuration” select static ip address and you need to make sure “Enable this connection” tick box is checked
Once you select the static ip address you need to select ip address,subnet mask,gateway address and click on ok
Now you click on “General” tab here you can enter your hostname,domain name
Next one you need to click on “DNS” tab to configure your system’s DNS settings, hostname, or DNS search path.
Click the Hosts tab, and then either click the Add or Properties button (after selecting a host) to create or edit an entry in your system’s /etc/hosts file
Highlight an existing entry, and then click the Properties button to change /etc/hosts entries in the Hosts tab of the Network Configuration screen.
You can also assign different locations to your computer, especially very useful if you are on a laptop and move between several networks each requiring different configurations. Just select the gray bar at the top of the network-admin window and select Create Location. Enter a name, such as Home and then repeat this again to create another location, Work. Each time you switch between locations, Ubuntu detects that it needs to use configurations specific to those locations, so for instance you might want to use DHCP at work, but not at home. Simple; just select the Home location, configure your ethernet connection to use a Static IP and you are all set to switch between your home and corporate networks.
Configure Network Interface Using Command-Line
You can configure a network interface from the command line using the networking utilities. You configure your network client hosts with the command line by using commands to change your current settings or by editing a number of system files.
Configuring DHCP address for your network card
If you want to configure DHCP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card
sudo vi /etc/network/interfaces
# The primary network interface – use DHCP to find our address
auto eth0
iface eth0 inet dhcp
Configuring Static IP address for your network card
If you want to configure Static IP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card
sudo vi /etc/network/interfaces
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
After entering all the details you need to restart networking services using the following command
sudo /etc/init.d/networking restart
Setting up Second IP address or Virtual IP address in Ubuntu
If you are a server system administrator or normal user some time you need to assign a second ipaddress to your Ubuntu machine.For this you need to edit the /etc/network/interfaces file and you need to add the following syntax.Below one is the only example you need to chnage according to your ip address settings
sudo vi /etc/network/interfaces
auto eth0:1
iface eth0:1 inet static
address 192.168.1.60
netmask 255.255.255.0
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x
You need to enter all the details like address,netmask,network,broadcast and gateways values after entering all the values save this file and you need to restart networking services in debian using the following command to take effect of our new ipaddress.
After entering all the details you need to restart networking services using the following command
sudo /etc/init.d/networking restart
Setting your ubuntu stytem hostname
Setting up your hostname upon a ubuntu installation is very straightforward. You can directly query, or set, the hostname with the hostname command.
As an user you can see your current hostname with
sudo /bin/hostname
Example
To set the hostname directly you can become root and run
sudo /bin/hostname newname
When your system boots it will automatically read the hostname from the file /etc/hostname
If you want to know more about how to setup host name check here
Setting up DNS
When it comes to DNS setup Ubuntu doesn’t differ from other distributions. You can add hostname and IP addresses to the file /etc/hosts for static lookups.
To cause your machine to consult with a particular server for name lookups you simply add their addresses to /etc/resolv.conf.
For example a machine which should perform lookups from the DNS server at IP address 192.168.3.2 would have a resolv.conf file looking like this
sudo vi /etc/resolv.conf
enter the following details
search test.com
nameserver 192.168.3.2
Network Troubleshooting Tips
Networking is sometimes considered to be complex, and hard to troubleshoot and manage. However, Linux provides you with Some tools to figure out exactly what’s going wrong on your network, and how to fix it.Here we are going see some tools and how to check the network connectivity.
Ping
Ping is a computer network tool used to test whether a particular host is reachable across an IP network. Ping works by sending ICMP “echo request” packets to the target host and listening for ICMP “echo response” replies (sometimes dubbed “Pong!” as an analog from the Ping Pong table tennis sport.) Using interval timing and response rate, ping estimates the round-trip time (generally in milliseconds although the unit is often omitted) and packet loss (if any) rate between hosts.
This is very basic and powerful tool to check Internet connection
Example
ping -c 4 google.com
-c option is used to pass how many packets you’re sending
If everything working file you should get reply looks like below
Pinging www.l.google.com [64.233.183.103] with 32 bytes of data:
Reply from 64.233.183.103: bytes=32 time=12ms TTL=244
Reply from 64.233.183.103: bytes=32 time=12ms TTL=244
Reply from 64.233.183.103: bytes=32 time=12ms TTL=244
Reply from 64.233.183.103: bytes=32 time=12ms TTL=244
Ping statistics for 64.233.183.103:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 12ms, Maximum = 12ms, Average = 12ms
Traceroute
traceroute is a computer network tool used to determine the route taken by packets across an IP network. An IPv6 variant, traceroute6, is also widely available.Very useful to trace IP packets.
Example
traceroute google.com
ifconfig
The Unix command ifconfig can function as a tool to configure a network interface for TCP/IP from the command line interface (CLI).This is another easy tool to see if your interface is actually loading correctly.
Example
ifconfig
eth0 Link encap:Ethernet HWaddr 00:0A:E6:C6:07:85
inet addr:132.18.0.16 Bcast:132.18.0.255 Mask:255.255.255.0
inet6 addr: fe80::20a:e6ff:fec6:785/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:18458 errors:0 dropped:0 overruns:0 frame:0
TX packets:8982 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4015093 (3.8 MiB) TX bytes:1449812 (1.3 MiB)
Interrupt:10 Base address:0xd400
Route
This is very useful to check routing config
Example
route -n
Netstat
If you want to see Routing Tables,all open ports,all listen ports
netstat -nr
-n means return numeric output (ie, IP address instead of hostname)
-r means print the routing table
find all open ports
netstat -a
find listening ports
netstat -l
What do you do if the ‘wired connection’ option is not there (the only option is ‘modem conection’). The computer is old but does have a network adapter.
-thank you for any help
>
Don’t do that on Ubuntu, since sudo rely on /etc/hosts (and at that point the hostname command does NOT change the 127.0.0.1 record) you will end with a system with no sudo rights, your only choice will be to boot a live cd, mount / and edit your hosts file.
The safest way to change the hostname on Ubuntu is to use the GUI (network-settings as shown on your capture), if you really want to do it via command line, keep in /etc/hosts your old and new name for 127.0.0.1, and use the hostname command.
Nice tutorial
Awesome! I am a total comp n00bz0r. Thanks!
Great, I like tutorials like these. It makes me learn Linux very fast and with fun, thanks to you.
Useful information, thank you for posting.
I do have one correction for you. In the section “Setting up DNS” you seem to have accidentally changed IP addresses from mentioning an example of a resolv.conf and actually showing the details of it (first the IP is 192.168.1.1 and then in the file you specify it as 192.168.3.2). This might be confusing for people that don’t understand the fact that this is a mistake resulting in one of those “tear-your-hair-out-WHY?” moments that I remember certain textbooks subjected me to.
Thanks again for posting.
thanks for your point and i have corrected the article now
hmm this here is one of the last reasons for people to not switch to linux, what is detailed above is about 25 more steps and half an hour longer than configuring wifi in windows. still i hold out hope for linux as vista is just bloat and waaaaay to expensive especially here in australia, where it is going to be priced at over $400 for the home premium (as if basic is going to sell!!!!)
anyways just my thoughts as a windows user who tries to switch every six months to linux only to be repelled by the wifi issue!!!
Network Manager is way nicer… “sudo apt-get install network-manager-gnome”. Then you don’t have to do any of this BS. This is just another reason that linux isn’t adopted into the mainstream since techies love to do things the hard way.
@josh
sure, if you want a brainless OS, run windows, and put up with all the spam, viruses, etc. if you can use more than 4 of your brain cells and can think a little, get linux. sure it might require a little work *gasp* but the rewards are far worth it. leave the mindless masses to run windows. enjoy.
Great tutorial! Helped me a lot. I finally managed to set my second IP so I can join the DC++ hub on my network. I am on one of this lame networks with 2 IPs. But I just have one problem. Every time I boot up my computer, my DNS servers are lost. I have to set them up again every time. Anybody have a solution? Thanks!
nice turtorial^^
in fact, for exact two days, I switched from Windows XP to ubuntun…and its in much ways better than winodws XP for me, because you’ll get pretty cool stuff, its for free, and safety 😀
what you want more ? 🙂
How can I use my Ubuntu machine as the “host” and have all others in my network access the internet via Ubuntu. I am using a Linksys wireless router, and Firestarter would be used on the ubuntu machine. I have tried several different tutorials with no luck.
Any suggestions?
Thanks
this article is very good.
thank.
all men remember that linux not limit.
@penguinlove:
Seriously, you need to get a life. If you got spam (which has nothing to do with your OS) and viruses while you were running Windows, it’s most likely your fault. The only time I’ve ever gotten any malware on a Windows box (yes, just once over the course of about 10 years,) it was my fault and was unrelated to the OS. Furthermore, it wasn’t actually able to do anything, it was just there.
Just because you run Linux (which, btw, I do, too) doesn’t mean you’re smarter than someone else. Most people do not have the time to spend trying to get their computer working correctly (editting conf files, compiling stuff from source, etc.) They need something that they can just install and it all works out of the box. Therefore, they use Windows.
Also, both Windows and Linux can have security holes, if they are not configured correctly. They can also both be quite secure if they are configured correctly. It’s not unique to either one.
By the way, good tutorial. 🙂
I want know more about installing network in ubantu6.06
Running samba
Would you be so kind as to reply to question number #1 above? I am having the exact same trouble — your tutorial is great, but my Networking options don’t list “Wired Connection”, even though the cable is plugged in and works fine when I boot into Windows. Please respond!!!!
well its nice tutorial. but I m interested in connecting internet through modem. If u can help in this regard.
thanks
Muollo has a good point. I just installed Ubuntu 6.06 on 17 April.
Windows crashed my system and I’ve lost years worth of files (ie Wedding Pics)
and my military records. So, I’ve rebuilt the system and trying this time
to get my system secured and networkable for home use. Can anyone help?
I’m beginner and it still not clear, the article should explain for beginner, Networking for 2 computers, one of them connect to internet (simple networking) for home use, next step is how to browse each other for file transfer and editing. Hope you can help me.
thanks for the help, would be nice to see what these things do
Will i get configuring ubuntu For usb .I have modem which has only usb connection with computer
log
http:www.newseminar.co.cc
for latest seminar
i want to connect UML (kernel 2.6.24) networking with host Ubuntu 8.04
khadafi@ubuntu:~$ uml_mconsole hP3SgL config eth0=tuntap,,,,192.168.0.254
OK
khadafi@ubuntu:~$ ifconfig tap0
tap0: error fetching interface information: Device not found
khadafi@ubuntu:~$ ping 192.168.0.254
connect: Network is unreachable
what the problem in above ????
How can i conect Ubuntu to windows xp? is it possible?
you have to enable remote desktop support in Ubuntu try to access using vnc viewer from windows xp this is one option and another option is install freenx server in ubuntu and install freenx client in xp now you can connect to ubuntu machine
i have bsnl nic wirelees card 144kbps.
how to use in ubuntu 8.10
give me ezy way to configur
ok
Thanks for the tutorial, really good, but how can I remove a network interface in ubuntu immediately using CLI?
I know I can remove interfaces from /etc/network/interfaces file, but some virtual interfaces are not listed there. I also know about “ifconfig down” command but what I want is to get rid of the interfaces completely.
What I am looking for is something like “ifconfig unplumb”, which is used in Solaris systems, but for Ubuntu. Does something like this exist?
Thanks a lot in advance,
Victor.
I can’t get ubuntu to connect…help.
Drive c= xp pro connects fine. ubuntu drive d=no internet connection.
ga-v7axp motherboard with realtech network interface.
This noob is pulling his hair out.
How can I use my Ubuntu machine as the “host” and have all others in my network access the internet via Ubuntu. I am using a Linksys wireless router,
Please help me
thanks for a very useful tutorial or a guide line.. Ü
i dont have networking in my Ubuntu,i have just Network tools,i need to configure networking>Networking options>TCP/IP networking >IPv6 protocol/config_tun=y.
Is it possible to connect a Windows machine to an Ubuntu network?
I want to emulate FTP ( both active and passive mode) with net cat. This is my college assignment. Can any body help?
Great tutorial. Nothing fancy, straight to the point. Thanks a lot!
how do i network 5 computers who are currently on the same router and runing windows and ubuntu operating system to see each other without the use of microsoft small business server. thank you
how you can network 5 office computer who are currently on the same router and running Windows and Ubuntu operating system to see each other without the use of Microsoft small business server (file server)
note is for file sharing only
Hello. I have about five ancient computers that I installed ubuntu and also xubuntu on. I am very new to ubuntu, and linux in general, and I would like to set up a wired ethernet connection between them, without internet. How is this accomplished?
Many thanks.
S.Patrick
sir i hv network tools no networking and there no modem or wire connection option in my ubuntu 10.04 how can i get networking in administration and solve the modem problem please sent me the answer.
now the latest ubuntu as been updated 14.04 u can install that it’s so nice nd easy also…. nd i think ur problem is also solved by installing this….
Ubuntu and windows work hand in hand, you can have a windows network with linux / ubuntu PC’s within or you can have a Linux network with windows in, it makes no difference, rather that the tools in each OS find it difficult to to pick each other up. If you are having problems, it will most probably be the settings on each, however it depends how your connecting, through a server or ?
This article could not be any more noob friendly
This guy has it 100%