linux route&nic config(Linux路由和网卡配置)
Linux card lost Linux service network restart Linux configuration IP
Just after the restart Linux, but not connected to the network, ifconfig, eth0 card no
[root@localhost ifconfig ~]#
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:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
Collisions:0 txqueuelen:0
RX bytes:864 (864 b) TX bytes:864 (864 b)
We supposed to do?
Immediate effect:
Ifconfig eth0 192.168.0.1 netmask 255.255.255.0
Start effective:
VIM /etc/sysconfig/network-scripts/ifcfg-eth0
join
IPADDR=192.168.0.1route add命令实例
NETMASK=255.255.255.0
And then restart the #:service network restart service network
------------------------------------------------------------------------------------------------------------------------------
Configuring IP address under Linux
Immediate effect:
Ifconfig eth0 192.168.1.102 netmask 255.255.255.0
Start effective:
VIM /etc/sysconfig/network-scripts/ifcfg-eth0
join
IPADDR=192.168.1.102
NETMASK=255.255.255.0
Modify default gateway
Immediate effect:
Route add default gw 192.168.1.1
Start effective:
VIM /etc/sysconfig/network-scripts/ifcfg-eth0 join
GATEWAY=192.168.1.1
Finally, the results are as follows:
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.102
NETMASK=255.255.255.0
GETEWAY=192.168.1.1
ONBOOT=yes
TYPE=Ethernet
Note: BOOTPROTO only in static (static) mode that can be used to set the IP information
Modify DNS
VIM /f
Changes can be effective immediately, start with the same effective
form
Join nameserver= ***.***.***.***
Can have up to three, as a failed candidate
Modify host name
Immediate effect:
Hostname FC2
Start effective:
VIM /etc/sysconfig/network
Form as follows:
NETWORKING=yes
HOSTNAME=
>>>>>>>>>>>###
First of all, understand the traditional network configuration commands first:
1. use the ifconfig command to configure and view the network interface.
The sample 1: eth0 configuration IP, and activate the device: Ifconfig eth0 192.168.4.1 netmask 255.255.255.0 up
Sample 2: eth0 aliase equipment eth0:1 IP, and add the routing Ifconfig eth0:1 192.168.4.2
Route add – host 192.168.4.2 dev eth0:1
Example 3: activate (disable) device
Ifconfig eth0:1 up (down)
Sample 4: view all (specify) network interface configuration Ifconfig (eth0)
-- -- ---
2. configure the routing table using the route command

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。

发表评论