Linux service IP address Modification

Source: Internet
Author: User
Ifconfig eth0 new IP
Then edit/etc/sysconfig/network-scripts/ifcfg-eth0 and modify the IP

[Aeolus @ db1 network-Scripts] $ VI ifcfg-eth0

Device = eth0
Onboot = Yes
Bootproto = static
Ipaddr = 219.136.241.211
Netmask = 255.255.255.255.128
Gateway = 219.136.241.254

[Aeolus @ db1 etc] $ VI resolv. conf

Nameserver 202.96.128.68
Nameserver 219.136.241.206

-----------------------
Modify the nic ip address and gateway in Linux

We recommend that you use the terminal character to modify it.
1. Modify the IP address
VI/etc/sysconfig/network-scripts/ifcfg-eth0
Device = eth0
Bootproto = none
Broadcast = 192.168.1.255
Ipaddr = 192.168.1.33
Netmask = 255.255.255.0
Network = 192.168.1.0
Onboot = Yes
Userctl = No
Peerdns = No
Type = Ethernet
~

VI/etc/sysconfig/network-scripts/ifcfg-eth1

Device = eth1
Onboot = Yes
Bootproto = none
Ipaddr = 192.168.2.34
Netmask = 255.255.255.0
Userctl = No
Peerdns = No
Type = Ethernet
Network = 192.168.2.0
Broadcast = 192.168.2.255
2. Modify the Gateway
VI/etc/sysconfig/Network

Networking = Yes
Hostname = Aaron
Gateway = 192.168.1.1

3. Restart the network configuration
/Etc/init. d/network restart

 

Bytes -----------------------------------------------------------------------------------

Modify configuration file

/Etc/sysconfig/network-scripts/has a configuration file

For example, the file: ifcfg-eth0 represents the configuration file of the actual Ethernet NIC 0

For example, the file: ifcfg-eth0: 1 represents the actual Ethernet NIC 0 configuration file

Domain Name Server Configuration File:/etc/resolv. conf

Modify IP Address
Effective immediately:
# Ifconfig eth0 192.168.0.20 netmask 255.255.255.0
Start effective:
Modify/etc/sysconfig/network-scripts/ifcfg-eth0

Modify the Default Gateway
Effective immediately:
# Route add default GW 192.168.0.254
Start effective:
Modify/etc/sysconfig/network-scripts/ifcfg-eth0

Modify DNS
Modify/etc/resolv. conf
The modification takes effect immediately and starts as well.

Modify host name
Effective immediately:
# Hostname FC2
Start effective:
Modify/etc/sysconfig/Network

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.