Linux: The network is a kernel feature
Change the NIC name
Rhel5:/etc/modprobe.cong
Rhel6:/etc/udev/rules.d/70-persistent-net.rules
Ifconfig eth0 displays only one network card information
-A: Displays configuration information for all interfaces
Ifconfig eth0 Ip/mask [Down|up]
The configured address takes effect immediately, but fails to restart the Network service or host
Network services:
RHEL5:/etc/init.d/network [Start|stop|restart|status]
RHEL6: Support the above script, the default is the following script, but the function is not very perfect, not supported on the cluster
Recommended to disable
/etc/init.d/networkmanager [Start|stop|restart|status]
Gateway:
Route View routing Table
Add: Adding
-host: Host Routing
-net: Network Routing
-net 0.0.0.0
Route add default GW 192.168.1.1
Route add-net 192.168.2.0/24 GW 192.168.1.1
Del: Delete route
Route del-net 192.168.2.0/24 GW 192.168.1.1
Delete default route
Route Del-net 0.0.0.0
Route del Default
All changes fail after restarting network service or host
Network configuration file:
/etc/sysconfig/network
Network Interface configuration file
/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
#关联的设备名, be consistent with the eth0 of the file name
Bootproto=dhcp
#引导协议: BOOTPROTO={DHCP|NONE|STATIC|BOOTP}
/* Static is used
Ipaddr=:ip Address
netmask=: Subnet Mask
gateway=: Setting the default gateway
*/
Onboot=: Whether this network interface is activated automatically when powered on Yes|no
Hwaddr=: Hardware address, to be consistent with the hardware address, you can omit
Userctl=no whether No|yes allows normal user to control interface change
Peerdns=yes If Bootproto is DHCP is the DNS address specified by the DHCP server to be accepted
Does not take effect immediately, but after restarting the network service or the host is in effect
Routing
/etc/sysconfig/network-scripts/route-ethx
Add format One
DEST via Nexthop
10.0.0.0/8 via 192.168.1.1
Network segment next hop IP
Add format Two
Address0= Network Segment
Netmask0= Network Segment Mask
gateway0= Gateway
The DNS server specifies a method with only one
/etc/resolv.conf
NameServer nds_ip_1
Nameserverdns_ip_2
Specify local resolution:
/etc/hosts
Host IP host name host Alias
192.168.5.26 lm.lv1314
Dns--/etc/hosts--nds
Configure host Name:
hostname hostname
Effective immediately, but not permanently
/etc/syscofig/network
Hostname=
Restart takes effect
/etc/sysconfig/network
Networking=yes whether the network function is enabled
~ ... Ipv6=no
Hostname=localhost.localdomain
Configuration method:
Ifconfig ethx:x Ip/netmask
/etc/sysconfig/network-scripts/ifcfg-ethx:x
Device=ethx:x
Non-primary addresses cannot be dynamically obtained using DHCP;
This article is from the "Wang Liming" blog, make sure to keep this source http://80cto.blog.51cto.com/7503144/1774394
Ifconfig, IP command explanation, route routing configuration, DNS configuration