Guide for Basic Knowledge of Linux Network Administration

Source: Internet
Author: User
Keywords network administration basics linux network administration what is linux network administration

Basic network configuration file

Alibaba Cloud Simple Application Server:  Anti COVID-19 SME Enablement Program
$300 coupon package for all new SMEs and a $500 coupon for paying customers.

Network connection configuration file: /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 #Associated device name
BOOTPROTO={static|dhcp|none|bootp} # indicates the boot protocol static|none indicates static; dhcp indicates dynamic
IPADDR=192.168.10.10 #Set the IP address
NETMASK=255.255.255.0 #Set the subnet mask
GATEWAY=192.168.10.1 #Set the gateway
ONBOOT=yes|no #Whether to automatically activate the network interface when booting
HWADDR=00:1E:0B:8F:B0:D0 #The hardware address should be consistent with the address in the hardware to save
DNS1=202.106.0.20 #Specify DNS address
USERCTL=yes|no #Indicates whether ordinary users are allowed to enable or disable this interface
PEERDNS=yes|no #Indicates whether to accept the dns address specified by the dhcp server when BOOTPROTO is dhcp
DEVICE=eth0 #Associated device name
BOOTPROTO={static|dhcp|none|bootp} # indicates the boot protocol static|none indicates static; dhcp indicates dynamic
IPADDR=192.168.10.10 #Set the IP address
NETMASK=255.255.255.0 #Set the subnet mask
GATEWAY=192.168.10.1 #Set the gateway
ONBOOT=yes|no #Whether to automatically activate the network interface when booting
HWADDR=00:1E:0B:8F:B0:D0 #The hardware address should be consistent with the address in the hardware to save
DNS1=202.106.0.20 #Specify DNS address
USERCTL=yes|no #Indicates whether ordinary users are allowed to enable or disable this interface
PEERDNS=yes|no #Indicates whether to accept the dns address specified by the dhcp server when BOOTPROTO is dhcp


DNS configuration file

vim /etc/resolv.conf/
nameserver 127.0.0.1
nameserver 127.0.0.1


Control whether the network is turned on and whether IPv6 is valid and the host name setting file

vim /etc/sysconfig/network
NETWORKING=YES|NO
NETWORKING_IPV6=yes|no
HOSTNAME=hostname
NETWORKING=YES|NO
NETWORKING_IPV6=yes|no
HOSTNAME=hostname

Define the host image file

vim /etc/hosts
172.168.10.1 www.baidu.com alias
172.168.10.1 www.baidu.com alias


Network card naming method

lo: local loopback is used by the local client to access the local server program
ppp#: point to point
eth#: Ethernet network card
/Etc/modprobe.conf in RHEL5.0: Define the network card name according to alias
In RHEL6.0 /etc/udev/rules.d/70-persistent-net.rules: defines the network card name according to the MAC address (udev file is a major change in the Linux 2.6 kernel; in the 2.4 kernel, it is provided in the /dev directory A large number of different device file access entries have reduced a lot of code under /dev in the 2.6 kernel. Because the udev mechanism is introduced, the corresponding device file can be automatically created according to the hardware information recognized by the kernel and given a specific name)


Network management tools

Linux currently provides two network management tools, one is network and the other is NetworkManager.


network

Network is to control the network interface configuration information after modification, the network service must be restarted to activate the new network configuration, so that the configuration takes effect. This part of the operation has the same effect on the service as when restarting the system. The control script is the file /etc/init.d/network. You can use this file with the following parameters to operate network services. E.g:

/etc/init.d/network restart
/etc/init.d/network restart
You can also use the service command to operate network services. For example:

service network restart
service network restart


NetworkManager

The newly added network management tool of RHEL6 can detect the network and automatically connect to the network. Whether it is a wireless or wired connection, it can be easily managed by you. For wireless networks, the network manager can automatically switch to the most reliable wireless network. The program of the network manager can be used to switch online and offline modes freely. The network manager can give priority to the wired network and supports VPN. The network manager was originally developed by Redhat and is now managed by GNOME.

The new version of NetworkManager enhances device and protocol support. The latest version of NetworkManager has a brand new beautiful client interface nmtui. "Nmtui" is a graphical front end of networkmanager. It can be used to configure and manage the network conveniently without X Window. Start nmtui:

[root@localhost ~]# nmtui

Basic knowledge of Linux network management

The biggest feature of the latest version of NetworkManager: Command line tool commands, a command line interface for NetworkManager. NetworkManager's CLI tool nmcli, using nmcli users can query the status of the network connection, and can also be used for management. Advantages: primitive; relatively simple syntax; easy to master using NetworkManager in CLI.

Basic configuration options of nmcli

nmcli con show #Get a UUID list
nmcli dev #View network devices and their status
nmcli r wifi off #Turn off WiFi
nmcli con show #Get a UUID list
nmcli dev #View network devices and their status
nmcli r wifi off #Turn off WiFi
After the NetworkManager daemon is started, it will automatically connect to the configured system connection. User connections or unconfigured connections need to be configured and connected through nmcli or desktop tools.

Start up NetworkManager

chkconfig NetworkManager on
Or (CentOS7)
systemctl enable NetworkManager
chkconfig NetworkManager on
Or (CentOS7)
systemctl enable NetworkManager

Start NetworkManager now

service NetworkMnager start
Or (CentOS7)
systemctl start NetworkManager
service NetworkMnager start
Or (CentOS7)
systemctl start NetworkManager
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.