Set static IP addresses in Linux

Source: Internet
Author: User

(1) The intuitive way is: if you use the fedora system, enter setup in the command line and enter the static IP address according to the wizard, refer to my article "Building a NAT test environment for VMware Workstation"


(2) modify the configuration file and enter
Vim/etc/sysconfig/network-Script
S/ifcfg-eth0


Device = eth0
Onboot = Yes
Bootproto = static
Ipaddr = 192.168.0.3
Netmask = 255.255.255.0
Gateway = 192.168.0.1


Device = eth0 <-- Device


Onboot = Yes <-- whether to start automatically


Bootproto = static <-- whether to use a static IP Address


Ipaddr = XXX. XX <-- your IP address


Netmask = 255.255.255.0 <-- your subnet mask


Gateway = 192.168.0.1 <-- your gateway


Make the IP address take effect:
/Sbin/ifdown eth0
/Sbin/IFUP eth0

Configure DNS resolution
Echo "nameserver 211.98.1.28">/etc/resolv. conf

Notify gateway to update information:
/Etc/init. d/network restart


DNS is the domain name
System, which can convert a domain name such as www.21php.com to an IP address such as 211.152.50.35; without DNS, browse 21php.com
This website must be accessed with numbers as hard to remember as 211.152.50.35. The DNS server provides the DNS service. DNS servers can be divided into three types: high-speed cache servers
(Cache-only server), master server (Primary name server), and secondary server (second name server ).

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.