CentOS Network Configuration
Environment:
System hardware: VMware vsphere (cpu:2*4 core, memory 2G)
System version: centos-6.5-x86_64
Router Gateway: 192.168.1.1
Steps:
1. View the network MAC address
[Email protected] ~]# Cat/etc/udev/rules.d/70-persistent-net.rules
Displays the following information
# PCI Device 0x15ad:0x07b0 (VMXNET3)
subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:50:56:94:04:3c", attr{type}== "1", kernel== "eth*" , name= "Eth0"
# PCI Device 0x15ad:0x07b0 (VMXNET3)
subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:50:56:94:53:24", attr{type}== "1", kernel== "eth*" , name= "Eth1"
Eth0: Corresponding to the first card, eth1: On the second net card. Currently using Eth0 connection router, eth1 reserved (server is generally used to connect other hosts)
2. Modify the host name
[Email protected] ~]# vim/etc/sysconfig/network
Open the file, modify the following and save
Networking=yes #使用网络
Hostname=centos #设置主机名称
3. Modify the NIC
[Email protected] ~]# Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Open the file, modify the following and save
Device=eth0 #对应第一张网卡
Type=ethernet
Onboot=yes #是否启动时运行
Nm_controlled=yes
Bootproto=static #使用静态IP instead of assigning IP by DHCP
Defroute=yes
Ipv4_failure_fatal=yes
Ipv6init=no
Name= "System eth0" #名称
hwaddr=00:50:56:94:04:3c #必须对应etho是的MAC地址 (/etc/udev/rules.d/70-persistent-net.rules)
Peerdns=yes
Peerroutes=yes
ipaddr=192.168.1.40 #指定本机IP地址
netmask=255.255.255.0 #指定子网掩码
gateway=192.168.1.1 #指定网关
4. Modify DNS
[Email protected] ~]# vim/etc/resolv.conf
Open the file, modify the following and save
NameServer 8.8.8.8 #GOOGLE的DNS服务器
NameServer 61.144.56.100 #指定当前城市最近的DNS服务器 (different cities, internet search)
NameServer 192.168.1.1 #指定经路由器上指定的DNS服务器
5. Restart the network configuration
[[Email protected] ~] #service Network restart
6. Restart
[[Email protected] ~] #shutdown-R now
7. View current IP Settings
[Email protected] ~]# ifconfig
8. Test whether to connect the external network
[[email protected] ~]# Ping www.163.com
Ubuntu Network Configuration
One, the configuration is roughly divided into three categories: configuration file configuration, through the command configuration, through the Graphical Network connection menu configuration.
No conditional experiments for dialing wireless, etc. are not involved.
Main files:/etc/network/interfaces, here are some configuration of IP, gateway, mask, etc./etc/resolv.conf this file holds information about DNS
Main command: sudo/etc/init.d/networking Restart restart the network, so that configuration file configuration invalid; sudo route add default GW <IP address, set gateway.
Second, the configuration method
1, through the command configuration
If you just want to temporarily modify the IP address, you can choose this method. Will be lost after restarting the network.
1) sudo ifconfig eth0 <ip address > netmask < subnet mask > up
Eth0 is a network card. The last up indicates that the network card is turned on and can not be added.
2) sudo route add default GW < Gateway Ip>
Setting up the Gateway
3) Set DNS, this must go to the configuration file modification, the same as the second
4) Configure host name
Command: Sudo/bin/hostname < host name >
However, when the system starts, the name of the host is read from/etc/hostname.
2. configuration file Configuration
1) Configure the IP gateway: sudo gedit/etc/network/interfaces inside add
of DHCP:
Auto loiface lo inet loopbackauto eth0iface eth0 inet DHCP
For static IP:
Auto loiface lo inet loopback#above is the loopback#configuration of Nic Eth0Auto Eth0#staic static IPiface eth0 inetStaticAddress192.168.1.5netmask255.255.255.0Gateway192.168.1.1#Network 192.168.3.0#Broadcast 192.168.3.255#The next two is the network number and the broadcast number, this can be calculated by other information, so there is no need to set
A second IP (virtual IP) can also be configured here
Auto Eth0:1iface eth0:1inetStaticAddress192.168.1.60netmask255.255.255.0#Network x.x.x.x#Broadcast x.x.x.xGateway x.x.x.x
2) Configure Dns:sudo gedit/etc/resolv.conf
202.107 . 117.11
3) Hostname: sudo gedit/etc/hostname enter host name inside. There is a host name by default, so this is not required.
4) Restart Network: sudo/etc/init.d/networking restart
You can also restart the network card:
sudo ifconfig eth0 down sudo ifconfig eth0 up
Restarting the network card has no effect on other network cards, more recommended.
3, through the Graphical Network connection menu configuration
This is in the system-preferences, also known as network manager, through the upper right-hand corner of the Web Management applet can enable its configuration.
This is a bit of a problem: it is shared with the second method of the configuration file, so it will cause a variety of conflicts, when used to pay attention to.
Instead, both of these methods are configured, sudo/etc/init.d/networking Restart is enabled for the second method of configuration, and clicking on Auto eth0 in the network Management applet on the desktop Panel enables the third configuration
SUSE Network Configuration
How to properly resolve the SuSE network configuration, here are the SUSE network configuration steps you want. From there you can learn more about the configuration of SuSE network configuration in a more concise and quick. Handle the SUSE network configuration correctly.
1.yast run, start the network card.
2. Enter/etc/sysconfig/netwrok/to find the corresponding network file. Typically a ifcfg-eth* file.
3.VI ifcfg-eth*
4. Typical Ifcfg-eth0 configuration
bootproto= ' Static '
Broadcast= ' 2.255.255.255 '
Ipaddr= ' 2.2.2.123 '
Mtu= "
netmask= ' 255.0.0.0 '
network= ' 2.0.0.0 '
Remote_ipaddr= "
Startmode= ' Onboot '
_nm_name= ' static-0 '
5./etc/init.d/network Start Network
6. Temporary ip:ifconfig eth0 2.2.2.123 up
7. Terminating and starting a network card: Ifdown eth0, Ifup eth0
8.IFCONFIG-A Displays the IP configuration.
This allows you to complete the SUSE network configuration.
Centoos,suse,ubuntu Various versions of the network configuration