Configuring/etc/sysconfig/network-script/ifcfg-eth0 in Linux

Source: Internet
Author: User

Network Interface configuration file
[Email protected] ~]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0
Type=ethernet #网卡类型
Device=eth0 #网卡接口名称
Onboot=yes #系统启动时是否自动加载
Bootproto=static #启用地址协议 –static: Static protocol –BOOTP Protocol –DHCP Protocol
ipaddr=192.168.1.11 #网卡IP地址
netmask=255.255.255.0 #网卡网络地址
gateway=192.168.1.1 #网卡网关地址
dns1=10.203.104.41 #网卡DNS地址
hwaddr=00:0c:29:13:5d:74 #网卡设备MAC地址
broadcast=192.168.1.255 #网卡广播地址
Re-import the Ifcfg-eth0 network configuration file
[Email protected] ~]#/etc/init.d/network Reload
Shutting down interface eth0: [OK]
Shutting down loopback interface: [OK]
Bringing up loopback interface: [OK]
Bringing Up interface eth0: [OK]

NIC interface shutdown and activation
[Email protected] ~]# ifdown eth0 #关闭网络
[Email protected] ~]# ifup eth0 #启动网络

Network Service startup and shutdown
Method One:
[[Email protected] ~]# service network stop #关闭网络服务
[Email protected] ~]# service network start #启动网络服务
[Email protected] ~]# service network restart #重启网络服务
Method Two:
[[email protected] ~]#/etc/init.d/network stop
[[email protected] ~]#/etc/init.d/network start
[Email protected] ~]#/etc/init.d/network restart
Network card status query
[Email protected] ~]# service network status
Configured devices:
Lo eth0
Currently active devices:
Lo eth0

The

temporarily configures network card information without rebooting.
[[email protected] ~]# ifconfig eth0 10.1.1.10 netmask 255.0.0.0
View NIC interface information, all interfaces are listed by default
[[email protected] ~]# ifconfig
eth0 Link encap:ethernet HWaddr 00:0c:29:13:5d:74
inet addr:192 .168.1.11 bcast:192.168.1.255 mask:255.255.255.0
Inet6 addr:fe80::20c:29ff:fe13:5d74/64 scope:link
Up Broadcast RUNNING multicast mtu:1500 metric:1
RX packets:413 errors:0 dropped:0 overruns:0 frame:0
TX packets:572 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:47701 (46.5 KiB) TX bytes:64842 (63.3 KiB)
Base address:0x2000 Memory :d 8920000-d8940000

Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up LOOPBACK RUNNING mtu:16436 metric:1
RX packets:407 errors:0 dropped:0 overruns:0 frame:0
TX packets:407 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:70759 (69.1 KiB) TX bytes:70759 (69.1 KiB)
view current Routing and gateway information
[Email protected] ~]# Netstat-r
Kernel IP Routing Table
Destination Gateway genmask Flags MSS Window Irtt Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
Default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

DNS:
Host Name: CentOS
Main dns:202.106.46.151
Second dns:202.106.0.20
Third dns:8.8.8.8

Network configuration:
Eth0
Static ip:192.168.1.106
Subnet Mask 255.255.255.0
Default Gateway IP 192.168.1.1

Device=eth0
ipaddr=192.168.1.106
netmask=255.255.255.0
broadcast=192.168.1.255
Onboot=yes
Bootproto=none
gateway=192.168.1.1
Type=ethernet
"/etc/sysconfig/network-scripts/ifcfg-eth0" 11L, 187C

Configuring/etc/sysconfig/network-script/ifcfg-eth0 in Linux

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.