1.Linux Configuring IP Address
Ifconfig command temporarily configures IP address
Ifconfig command, the most common function is to view the local network configuration status (of course, can also configure the network, but temporarily), directly enter the Ifconfig command can see all the network card information
Ifconfig eth0 192.168.0.200 netmask 255.255.255.0: Temporarily set the IP address and subnet mask of the ETH0 network card
Setup tool permanently configures IP address
But this command is the Redhat series of Linux commands, not the Debian series of Linux commands (the Debian series includes: Bebian, Ubuntu ...). )
How to modify a network configuration file to permanently configure IP
For example, in Ubuntu, because there is no Setup command, so only through the direct modification of the network configuration file to configure the IP, in fact, Setup is an interactive way to modify the network configuration file (only in a different way, the end is actually modified network configuration file), So the Redhat series of Linux can of course configure the IP by modifying the configuration file
After modifying the network settings under Linux does not need to restart the computer, only need to restart the relevant settings options, network settings modified (such as the replacement of IP, domain, etc.): if it is redhat, restart the network can be entered service network restart or/etc/rc.d/ Init.d/network restart. In the case of SuSE, there are three ways to restart the network: 1, service network Restart 2, rcnetwork restart 3,/etc/rc.d/network restart
Nic Information file
File Address:/etc/sysconfig/network-scripts/ifcfg-eth0 (this is on Redhat, Ubuntu is not here), the approximate file content and explanation are as follows:
Device=eth0 NIC Device name Bootproto=none whether to obtain IP (none, static, DHCP) hwaddr=00:0c:29:17:c4:09 MAC address automatically nm_ Whether the Controlled=yes can be hosted by the Network Manager graphical management tool Onboot=yes is started with the networking service, eth0 effective type=ethernet type is Ethernet uuid= " 44B76C8A-B59F-44D5-83DA-323F32E32A2 " Unique ID (here I was a random input) ipaddr=192.168.0.252 IP address netmask=255.255.255.0 Subnet Mask gateway=192.168.0.1 gateway dns1=202.106.0.20 dnsipv6init=no IPV6 not started Userctl=no Do not allow non-root users to control this network card, it is recommended to set to No
Beware of the UUID, such as the need to install multiple servers, a single installation will be more cumbersome, so you may install one, and then copy it to another computer's image (will currently install Linux to other servers), At this time may appear multiple computers Oh network card UUID the same situation, there will be conflicts, so that all computers are unable to surf the Internet, you must manually change
For example, in the virtual machine directly copy someone else's image must be careful of this, or two people can not be a virtual machine to the Internet!!!!!!!!!!!!!!!!!!! uuid!!!!!!!! must be modified
Modify UUID
1. Delete the information for the line that contains the MAC address in the/etc/sysconfig/network-scripts/ifcfg-eth0 configuration file
2. Remove the NIC and MAC address bindings file: Rm-rf/etc/udev/rules.d/70-persistent-net.rules
3. Restart your computer
Host name File
File address:/etc/sysconfig/network, File contents
Networking=yes Network Service is not working, should be set to Yes, if for Bo, the network is not functioning Hostname=localhost.localdomain host name
hostname command to view the host name of this machine
Hostname Name: Temporarily change host name (restart and restore the original hostname), if you change the host name through the configuration file, you need to restart the computer to take effect
DNS configuration file
File address:/etc/resolv.conf, File contents
NameServer 202.106.0.20 Configuring the IP address of the preferred DNS serch localhost
You can configure multiple DNS
Configure IP in graphical interface mode
This is not possible at all in the server, just install Linux on the PC graphical interface can use this method, this is not involved, because it can be completely used in the above three methods to solve, and the use of graphical interface in Linux is not to reduce the Bige
Linux Network management 1---(Linux config IP address, ifconfig,)