You are on page 1of 13

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

Ubuntu Linux Tutorials,Howtos,Tips & News | Natty,Maverick,Lucid

Home Forum Free Ubuntu E-Books Submit Article Top Posts Ubuntu Hosting Contact About Subscribe Sitemap Privacy Policy Search
Ads by Google Ubuntu VPS Ubuntu Cloud DVD Ubuntu Ubuntu Wiki Ubuntu ERP

Sponsor

Ads by Google
Install Ubuntu Tutorial on Ubuntu Ubuntu Linux System Tips for Ubuntu Flash Player Ubuntu

Categories

1 of 13

04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

Backup Free Books General Monitoring Networking News Package Mgmt Security Server

Sponsor
Ads by Google
Flash Player Ubuntu Ubuntu User Guide Ubuntu Hyper V Ubuntu or Kubuntu Ubuntu netBook

Login/Register
Register Log in

Archives

Ubuntu Networking Conguration Using Command Line


February 5, 2007 Networking Email This Post
Share 92

If you're new here, you may want to subscribe to my RSS feed and if you have questions related to your ubuntu system post question to our forums. Thanks for visiting! The basics for any network based on *nix hosts is the Transport Control Protocol/ Internet Protocol (TCP/IP) combination of three protocols.
2 of 13 04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

This combination consists of the Internet Protocol (IP),Transport Control Protocol (TCP), and Universal Datagram Protocol (UDP). By Default most of the users congure their network card during the installation of Ubuntu. You can however, use the ifcong command at the shell prompt or Ubuntus graphical network conguration tools, such as networkadmin, to edit your systems network device information or to add or remove network devices on your system 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 Note :- Use vi editor if you dont have GUI installed If you have GUI use the following command gksudo gedit /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 Note :- Use vi editor if you dont have GUI installed If you have GUI use the following command gksudo gedit /etc/network/interfaces

3 of 13

04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

# 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 Note :- Use vi editor if you dont have GUI installed If you have GUI use the following command gksudo gedit /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

4 of 13

04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

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 doesnt dier from other distributions. You can add hostname and IP addresses to the le /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 Note :- Use vi editor if you dont have GUI installed If you have GUI use the following command gksudo gedit /etc/resolv.conf enter the following details search test.com nameserver 192.168.3.2

5 of 13

04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

Related posts Update IP addresses at dynamic DNS services Using ddclient (17) slurm - Realtime network interface monitor (2) Securing SSH Using Denyhosts (10) Mount Network File systems (NFS,Samba) in Ubuntu (10) Howto Install Freecom Musicpal in Ubuntu Feisty (3) How to Setup Transparent Squid Proxy Server in Ubuntu (35) How to Install PPTP GUI (To connect windows VPN) in Ubuntu (9) Ubuntu Networking Conguration Using Graphical Tool Ubuntu Network Troubleshooting Tips

115 Comments to Ubuntu Networking Conguration Using Command Line


1. khiz says: April 29, 2010 at 12:00 pm @ rduke15 you have no idea how much you helped by the gedit instead of vi tip. thanks a lot 2. Zen of Linux says: May 18, 2010 at 4:31 pm Or replace vi with nano, for everyone coming from windows, the simple and intuitive nano editor is a heaven sent! 3. Ian says: May 25, 2010 at 8:29 am Hey, could you post the default loopback part of the network config? I deleted it accidentily and am unsure how to get it back. It was simply two lines of code something like auto lo inet an_ip_maybe? iface lo something something Much appreciated. Thanks 4. Joe says: May 26, 2010 at 2:44 pm # The loopback network interface
6 of 13 04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

auto lo iface lo inet loopback 5. syahril says: June 15, 2010 at 7:09 am any one know,how to set load balancing in linux? 6. Josh says: July 31, 2010 at 11:07 pm Im trying to add a second nic without re-install, need it to use heartbeat, I have latest lucid server that was an upgrade from 9.10..does not detect the nic though..any help appreciated! 7. Bizax says: August 27, 2010 at 6:58 am Thanks. This tutorial very good. 8. dev says: November 7, 2010 at 5:59 pm i have a lap and dekstop. both ubuntu 9.10. how to share files? i have cross crimbed network cable. any help in this matter? 9. hsain says: November 14, 2010 at 7:09 am i just try ubuntu 9.10 server. i want to know 1. How do i know that the lan card is installed? 2. if there are more than one lan card, how do i now the interface number of the cards? 10. admin says: November 14, 2010 at 8:29 am Run the following command from your terminal and see the output ifconfig 11. hsain says: November 14, 2010 at 8:35 am as far as i know ifcong doesnt inform the type of lan card. if i have 3 lan cards, i need to know which one is eth0, eth1, and eth3.

7 of 13

04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

12. khali says: December 12, 2010 at 6:37 am Thanks. Useful help for me> 13. jack says: December 17, 2010 at 12:55 am Once you add the two lines of code, how do you save? 14. Josh says: December 17, 2010 at 11:30 pm I think it would be the esc key then shift :w to write, then esc shift :q! to exit out? using vi. 15. Josh says: December 17, 2010 at 11:32 pm jus smak me if im wrong..lol 16. Josh says: December 17, 2010 at 11:33 pm p.s. for go..sake, backup the orig! 17. Mehdi says: December 18, 2010 at 12:55 am Jack; If you have pico (or nano) you can edit and then save by Ctrl X (to exit) then press Y for yes. if you are using vi (which I know very little about) do as Josh said above. Also you can do shift ZZ to exit vi. as already said, good idea to save a copy first. like cp file.1 file.2 then pico file.1 if anyone else knows of another cool editor let us know please.(I assume that ppl are using command line or terminal & not GUI or X). 18. Biswajit says: December 30, 2010 at 10:37 am this is good but i tried same like this but my network is not configured.ip
8 of 13 04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

address cant accept it.help me 19. Mehdi says: January 1, 2011 at 10:25 pm Biswajit; are you using wireless or wired network? has linux found your network card? are you using xwindows or command line? do you have access to your router/dhcp server (is this at home or at work)? did you run the ifconfig -a and see what it says? 20. ieee488 says: January 13, 2011 at 2:07 pm +1 to rduke15 for point out the insanity of using vi instead of the much simpler gedit to edit /etc/network/interfaces file. unless you installed Ubuntu to not use X graphical interface, there is no reason to use vi. USE gedit 21. Orphis says: January 13, 2011 at 10:28 pm Thanks to Joe for publishing the default loopback interface, sorry for the late thanks. And to ieee488, the poster actually says Note :- Use vi editor if you dont have GUI installed; So your statement is rendered pointless. 22. Susanta Roy says: February 16, 2011 at 4:18 pm To Check How many Network Interface Cards Install, execute the following command, susanta@admin:~$ ifconfig Note: if numbers of network card installed then it recognized as eth0,
9 of 13 04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

eth1, eth2, . . . in Linux 23. rex says: March 3, 2011 at 2:41 am nice tuts!!! now i have alias 24. Arnaud says: March 8, 2011 at 9:08 pm Now that we have two interfaces and two ip. How can we force a program to use only one interface ? I can set QoS and operational time on my router per IP. So, for example, I can define low bandwidth during the day for that specific IP in my LAN. I would like to force a specific program to use only one IP and all other applications use the the other one. Thanks ps vi is extremely efficient and fast compared to gedit. I admit that you have to get use to it. 25. Praveen says: April 4, 2011 at 9:54 am Ubuntu is cool Older comments Very nice collection of Terminal commands

Leave a Reply
Name (required)

Mail (will not be published) (required)

Website

10 of 13

04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

Submit Comment
Notify me of followup comments via e-mail Ubuntu Networking Conguration Using Graphical Tool Ubuntu Network Troubleshooting Tips

Recent entries
A simple GUI for Unity-2D Settings on ubuntu 11.04 (Natty) Ubuntu 11.04(Natty) installation screenshots Gallery Running Ubuntu 11.04 (Natty) unity 3D on virtualbox 4.x Daily Journal - Journal application for Ubuntu that keeps one page per day EasyShutdown: GUI to turn a computer off after specific time

Free Ubuntu E-Book


A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Recent comments
David: Thanks a lot ! Augustine: i got it great...thanks for everything I Augustine: I tried GUI

Getting Started with Ubuntu 10.04 (Lucid Lynx) is a comprehensive beginners guide for the Ubuntu operating system. Download Now

11 of 13

04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

method as well downloading a Jan: How do I go from here? I followed everyt sohail veerwani: great tips 4 accelerating the Firefox

RSS Feed

Popular posts
Speed Up Firefox web browser (201) iPhone Tethering on Ubuntu 9.10 (Karmic) (165) Send and Receive Your Hotmail messages through Evolution (151) How to Install Java Runtime Environment (JRE) in Ubuntu (147) Atheros AR5007 wireless with madwifi on Ubuntu 8.04 (Hardy heron) (144) 2006-2010 All rights reserved. Ubuntu Geek

UbuntuGeek on Twitter

Ads by Google

Precision-Fit Data Center


Servers w/ Intel Xeon Processors Energy Efficient & Cost Effective!
ZTSystems.com

RAID Recovery
12 of 13 04/24/2011 02:39 PM

Ubuntu Networking Conguration Using Command...

http://www.ubuntugeek.com/ubuntu-networking-co...

Data Recovery HP Coupons Codes Server data recovery Web Hosting

Support Ubuntugeek
Amount $: Website(Optional):

Favourite Sites
My Daily Tech Tips Windows Reference Debian Admin DebianHelp SuSe Linux Tutorials Ubuntux Tuxmachines Unixmen Arabic ubuntu support

13 of 13

04/24/2011 02:39 PM

You might also like