Set static IP address in Ubuntu 13.04

Source: Internet
Author: User
Tags nameserver

Switch to the root user and enter the/etc/network directory. Backing up interfaces files (it is a good habit to back up files)

Edit the interfaces file and add the following statement:

1 # Assgin static IP by eric on 26-SEP-20122 iface eth0 inet static3 address 192.168.196.135         #change to your static IP4 netmask 255.255.255.0           #change to your netmask5 gateway 192.168.196.255         #change to your getway6 #We must specify dns-nameserver here7 #in order to get internet access from host8 dns-nameservers 192.168.196.2559 auto eth0

After editing, the content of the interfaces file is as follows:

[email protected]:/etc/network# cat interfaces# interfaces(5) file used by ifup(8) and ifdown(8)auto loiface lo inet loopback#add by andy at 2014-08-14# Assgin static IP by eric on 26-SEP-2012iface eth0 inet staticaddress 192.168.196.135         #change to your static IPnetmask 255.255.255.0           #change to your netmaskgateway 192.168.196.255         #change to your getway#We must specify dns-nameserver here#in order to get internet access from hostdns-nameservers 192.168.196.255auto eth0

The next step is to restart the NIC:

[email protected]:/etc/network# /etc/init.d/networking restart

After the restart is complete, test:

 [email protected]:/etc/network# ping www.baidu.com.cn PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data. 64 bytes from 220.181.112.244: icmp_req=1 ttl=128 time=6.12 ms 64 bytes from 220.181.112.244: icmp_req=2 ttl=128 time=14.7 ms

OK. Static IP Address Settings are complete.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.