View and modify IP addresses in RedHat

Source: Internet
Author: User
First, view the current machine Nic IP1 display the currently started network interface command: ifconfig2 view all current network interface command: ifconfig-a3 view the specified network interface command: ifconfigeth0 IP address modification in LINUX is divided into two situations, 1 modified during debugging

First, check the IP address of the NIC of the current machine.

1. display the currently started network interface commands:

Ifconfig

2. View all current network interface commands:

Ifconfig-

3. view the specified network interface command:

Ifconfig eth0

IP address modification in LINUX is divided into two situations,

1. modify the IP address during debugging. it takes effect only for the moment. after restart, it is restored to the original IP address.

Ifconfig eth0 192.168.63.27 netmask 255.255.255.0 route add defaultgw 192.168.63.1 up

2. it will take effect permanently (that is, it will take effect after restart)

Method 1: configure the Nic configuration file

Modify/etc/sysconfig/network-scripts/ifcfg-eth0

Vi/etc/sysconfig/network-scripts/ifcfg-eth0 # Second Nic: vi/etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE = eth0 # physical DEVICE name

IPADDR = 192.168.1.10 # IP address

NETMASK = 255.255.255.0 # mask value

NETWORK = 192.168.1.0 # NETWORK address (optional)

BROADCAST = 192.168.1.255 # BROADCAST address (optional)

GATEWAY = 192.168.1.1 # GATEWAY address

ONBOOT = yes # [yes | no] (whether to activate the device during boot)

USERCTL = no # [yes | no] (whether non-root users can control the device)

BOOTPROTO = static # [none | static | bootp | dhcp] (no protocol used during boot | static allocation | BOOTP protocol | DHCP protocol)

Restart the service network restart to take effect, or/etc/init. d/networkrestart to take effect.

Method 2:

Save ifconfig eth0 192.168.63.27 netmask 255.255.255.0 route adddefault gw 192.168.63.1 to the/etc/init. d/rc. local file.

Related Article

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.