码迷,mamicode.com
首页 > Web开发 > 详细

RHEL/CentOS 6 (command line) Networking

时间:2015-07-18 21:08:28      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

RHEL/CentOS 6 does not configure network interfaces on default installation. Also, it is 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 have 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 an 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

标签:

原文地址:http://www.cnblogs.com/qike/p/4657461.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!