Fast learning -Linux network settings

First, the network settings

1, ip address View

Desired scene: remote connection, configuration software (VPN)
instruction: #ifconfig
Here Insert Picture Description
information that are:
① there are two cards, called eth0, another LO (local loopback adapter, native IP)
② IP address inet addr that a

2, NIC configuration file

Location: / etc / sysconfig / network- scripts / ifcfg- * File
Here Insert Picture Description
Here Insert Picture Description
ONBOOT: Indicates whether to automatically connect
BOOTPROTO (COL): card protocol used after start, under normal circumstances is the DHCP
the HWADDR: hardware address (mac address, physical address), communication between computers are dependent on the mac address (ARP)

Extended: like for NIC configuration file directory level deeper, if required frequent changes can be required to set up a shortcut to the file, which often operate on directories to simplify subsequent open file operations.

Here Insert Picture Description
Syntax: #ln -s original path shortcut path

Case: The ifcfg-eth0 file to create a shortcut home in the root directory.

#ln -s /etc/sysconfig/network-scripts/ifcfg-eth0 /root/wangka.conf

In the Create Shortcut when the original path sure to write the full absolute path, otherwise the latter will not find the original file.

Here Insert Picture Description

3, the network service operations (understand)

Can restart the network service via the service command / stop / start operation.

Syntax: #service network start/stop/restart(NIC operation of all devices)
Here Insert Picture Description
described above is equivalent to the instructions further:#/etc/init.d/network start/stop/restart

Expanding the user for a single card:

#ifdown 网卡名				停止某个网卡
#ifup 网卡名					启动某个网卡

Here Insert Picture Description

Note: These operations do not arbitrarily run on the server.

Released 1939 original articles · won praise 2057 · Views 180,000 +

Guess you like

Origin blog.csdn.net/weixin_42528266/article/details/105143030