Rhel/centos 6 (command line) Networking

Source: Internet
Author: User

Rhel/centos 6 does not configure network interfaces on default installation. Also, it's configured to use NetworkManager. To enable networking interface and disable NetworkManager please follow instructions below.

The/etc/sysconfig/network-scripts/ifcfg-eth0 content looks as follows on default installation.

Device= "Eth0″
HWADDR=SPECIFC MAC Address
Nm_controlled= "Yes"
Onboot= "No

For DHCP, configure the interface as follows.

Device= "Eth0″
HWADDR=SPECIFC MAC Address
Nm_controlled= "No"
onboot= "Yes"
Bootproto= "DHCP"

Restart the network after configuration.

/etc/init.d/network restart
Or
Service Network restart

For Static IP, configure it as follows

Device= "Eth0″
HWADDR=SPECIFC MAC Address
Nm_controlled= "No"
onboot= "Yes"
bootproto= "Static"
Ipaddr=ip address here.
Netmask=netmask here.

Change The/etc/sysconfig/network to the GATEWAY.

Networking=yes
Hostname=www.linuxbyanish.com
Gateway=gateway address here.

Restart the network after configuration.

/etc/init.d/network restart

To see current IP address information for eth0:-

# IP Addr Show eth0

To see routing information:

# IP Route Show

Ifconfig Command Example

Simply Type the ifconfig command as follows to display eth0 IP information:

# ifconfig Eth0

Eth0 Link encap:ethernet HWaddr b8:ac:6f:65:31:e5
inet addr:192.168.1.100 bcast:192.168.1.255 mask:255.255.255.0
Inet6 ADDR:FE80::BAAC:6FFF:FE65:31E5/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:308560 errors:0 dropped:0 overruns:0 frame:0
TX packets:217836 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:431112624 (431.1 MB) TX bytes:20994801 (20.9 MB)
Interrupt:17
Type the following command to display a IP and its netmask:
# ifconfig Eth0 | grep ' inet addr: '
Sample outputs:
inet addr:192.168.1.100 bcast:192.168.1.255 mask:255.255.255.0

Rhel/centos 6 (command line) Networking

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.