Linux network card boot, configuration

Source: Internet
Author: User
Tags nameserver

Step 1, configure the files in the/etc/sysconfig/network-scripts/ifcfg-eth0.

Configuration details for Ifcfg-eth0:
[Email protected] ~]# Vim/etc/sysconfig/network-scripts/ifcfg-eth0

Device= "Eth0"
Hwaddr= "00:0C:29:FD:FF:2A"
Nm_controlled= "Yes"
onboot= "Yes"
ipaddr=192.168.1.31
netmask=255.255.255.0
gateway=192.168.1.1
Bootproto=static

The previous three lines are the system Jairus, followed by manual additions.
So set the buckle, remember to restart the network card:
[[email protected] ~]#/etc/init.d/network stop
[[email protected] ~]#/etc/init.d/network start

Step 2, modify DNS
[Email protected] ~]# vi/etc/resolv.conf
Add two DNS to the inside:
NameServer 202.96.134.133
NameServer 8.8.8.8
OK, big attack Gaocheng, you can surf the Internet.

The following is a reference, if you do not follow the above steps, you can look at the following details:
Network Interface configuration file
[Email protected] ~]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
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

Temporary configuration of network card information without rebooting.
[email protected] ~]# ifconfig eth0 10.1.1.10 netmask 255.0.0.0
View NIC interface information, list all interfaces 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:d8920000-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

Linux network card boot, configuration

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.