How to connect internet in ubuntu linux
Share the post "How to connect internet in ubuntu linux"
Connecting to internet is an important task for every user. This guide explains you how to connect internet in ubuntu linux. There are two ways to connect internet in ubuntu, one is wired connection and another is wireless connection. Also add name server entries in resolv.conf
Open Terminal and edit /etc/resolv.conf
vim /etc/resolv.conf
nameserver 8.8.8.8 # Primary nameservernameserver 8.8.4.4 # Secondary nameserver
Setup Wired Connection
If you are using dial-up connection, follow this documentation : How to connect internet using PPPOE
The other way is connecting to internet via DHCP Server, It provides both dynamic and static ip address to client boxes.
Assign Dynamic IP Address
If you are willing to use DHCP dynamic ip address, set your /etc/network/interfaces entries as shown below
vim /etc/network/interfaces
# Loopback IP Addressauto lo
iface lo inet loopback# DHCP Wired Connection : eth0 device
auto eth0
iface eth0 inet dhcp
Assign Static IP Address
If you are having static ip then setup your /etc/network/interfaces entries as shown below
# Loopback IP Address
auto lo
iface lo inet loopback# DHCP Wired Connection : eth0 device
auto eth0
iface eth0 inet static
address 192.168.1.123
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.73
Setup Wireless Connection
If you are having wireless connection and you are using DHCP Server for assigning ip address then follow the below procedure
Assign Dynamic IP Address
If you are willing to use dynamic address, setup the /etc/network/interfaces entry as shown below.
vim /etc/network/interfaces
# Loopback IP Addressauto lo
iface lo inet loopback# DHCP Wireless Connection : wlan0 device
auto wlan0
iface wlan0 inet dhcp
Assign Static IP Address
If you would like to use static ip address then setup your /etc/network/interfaces as shown below
vim /etc/network/interfaces
# Loopback IP Addressauto lo
iface lo inet loopback# DHCP Wired Connection : wlan0 device
auto wlan0
iface wlan0 inet static
address 192.168.1.125
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.73
After configuring it please restart the network services
/etc/init.d/networking restart
or
service networking restart
Gateway
Check the gateway, if you don’t have gateway information in route entry add gateway information in it.
route -n
or
netstat -rn
If you want to delete the default gateway
route del default gw
If you want to add a default gateway
route add default gw
Connecting internet with Modem
If you are having wireless modem ( for example : Reliance Netconnect + ) then you need to install some wireless tools before to configure it.
WV-dial is an utility, point to point protocol dialer which allows your modem to connect with internet.
Usually the wvdial configuration file is located under /etc/wvdial.conf which contains basic information about the modem port, speed, and init string, along with information about your Internet Service Provider (ISP), such as the phone number, your username, and your password.
Run wvconf in your terminal, it will create a configuration file. After running wvdial it will probe your common ports, looking for a modem, and determine the capabilities of any modems.
sudo wvdialconf
Scanning your serial ports for a modem.ttyS1<*1>: ATQ0 V1 E1 — OK
ttyS1<*1>: ATQ0 V1 E1 Z — OK
ttyS1<*1>: ATQ0 V1 E1 S0=0 — OK
ttyS1<*1>: ATQ0 V1 E1 S0=0 &C1 — OK
ttyS1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 — OK
ttyS1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 S11=55 — OK
ttyS1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0 — OK
ttyS1<*1>: Modem Identifier: ATI — 28800
ttyS1<*1>: Speed 2400: AT — OK
ttyS1<*1>: Speed 4800: AT — OK
ttyS1<*1>: Speed 9600: AT — OK
ttyS1<*1>: Speed 19200: AT — OK
ttyS1<*1>: Speed 38400: AT — OK
ttyS1<*1>: Speed 57600: AT — OK
ttyS1<*1>: Speed 115200: AT — OK
ttyS1<*1>: Max speed is 115200; that should be safe.
ttyS1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0 — OK
ttyS0<*1>: ATQ0 V1 E1 — ATQ0 V1 E1 — ATQ0 V1 E1 — nothing.
Port Scan<*1>: S2 S3Found a modem on /dev/ttyS1.
If you didnt get output as shown above, please check your modem connectivity.
This is the sample wvdial.conf file
[Dialer Defaults]
Modem = /dev/ttyS1
Baud = 57600
Init = ATZ
Init2 = AT S11=50
Phone = your phone number
Username = your username
Password = your password
Save and quit the file
For more about WVdial check this ubuntu documentation
Now activate your connection by using the following command
sudo ifconfig eth0 up

For more check this documentation : Activating and deactivating Network Interface Cards
To check your assigned ip address information use ifconfig command.
ifconfig
If you have any problems to connect internet, please let me know through comments.
Share the post "How to connect internet in ubuntu linux"
Related articles
- How to install skype on ubuntu 11.10 / 11.04 / 10.10 / 10.04
- How to install nginx in ubuntu
- Get linux OS details – Kernel version, distribution version, name, architecture, codename, release
- How to connect Mobile Broadband in the ubuntu linux
- Easy method to update bootloader in linux
- How to install Skype on ubuntu linux
- How to change the Apache HTTP port number
- Apache HTTP Server installation from source code in linux
- How to check the Video and Audio File properties – Media Information
- Glances – Monitoring tool for Linux and BSD
Advertisement
Follow us on Twitter
Follow us on GooglePlus
Find us on Facebook
Recent Posts
- Easy method to install Skype in CentOS 6.3, RHEL – 6.3
- Easy method to recover linux root password
- Easy method to install KDE in ubuntu 12.04
- How to disable selinux
- Change selinux to permissive
- How to check selinux status
- Get website details
- How to install nginx in ubuntu
- How to install nginx in RHEL 5
- How to install nginx in RHEL 6
- How to install nginx in centos 5
- Get linux OS details – Kernel version, distribution version, name, architecture, codename, release
- Service start, stop, restart – nginx in centos
- How to change nginx port number
- How to install nginx on centos 6
- Rsync command with ssh port number
- File creation date and time in linux
- How to install Java in ubuntu linux
- How to install Oracle Java JDK in ubuntu
- How to set password for website
- Plesk – MySQL admin login – password
- How to install and configure PHPMyAdmin from source code in CentOS / RHEL / Fedora linux
- How to find out mysql uptime
- How to backup and restore mysql database
- How to recover mysql root password
- How to connect Mobile Broadband in the ubuntu linux
- Easy method to update bootloader in linux
- Webcam software for linux
- Check memory usage in linux
- How to find out CPU utilization in linux
