Linux 18th Day Self-study network management
Time: 20180804
Directory
Ifconfig
Ip
GUI Configuration Network
Configuration file Modify NIC parameters
Routing Management IP, route
Common network detection Tools ping, traceroute, SS, Netstat, Iftop, MTR, nethogs
Linux Network Management
Ifconfig Viewing network interface configuration
Package name Net-tools
Enable or disable a network interface
Ifconfig IFNAME Up|down
Ifup IFNAME
Ifdown IFNAME
Set IP address (cent6 effective, 7 not possible)
Ifconfig IFNAME Ip/netmask [up]
Ifconfig IFNAME IP netmask netmask
The address you set will take effect immediately, but will not be permanently enforced.
IP configuration NIC Parameters
Package name Iproute
IP [OPTIONS] OBJECT {COMMAND | help}
OBJECT: = {link | address | addrlabel | route | rule | neigh |
ntable | Tunnel | Tuntap | maddress | Mroute | Mrule |
Monitor | xfrm | Netns | L2TP | Tcp_metrics | Token |
MACSEC}
Link
Set set interface properties
IP Link Set DEVICE
{Up|down} enable disable device
Promisc {On|off} supports promiscuous mode
Name NEWNAME set the interface with the new name
Show display interface Status
Setting parameters will take effect immediately but will not be permanent
Addr (cent7 Effective)
Add address
Del Delete address
IP addr {add|del} ifaddr dev IFNAME
Show display NIC all information
Flush Clear Protocol Address
IP addr flush [Dev IFNAME]
Route
List|show Show routes
Add route
IP route add DESTINATION via GATEWAY [Dev IFNAME]
IP route add default via 172.16.48.1
del Delete route
IP Route del DESTINATION
IP route del default
IP Route del 172.16.0.0/16
GUI Configuration Network
Cent6:setup
Package name Setuptool
Cent7:nmtui (Text User Interface for controlling NetworkManager)
Package name NetworkManager
Configuration file Modify NIC parameters
/etc/sysconfig/network-scripts/ifcfg-ifname
Modifying this profile does not take effect immediately, but is permanent.
Common parameter Descriptions
Device to which this profile is associated, which is typically the ifname in Ifcfg-ifname
Bootproto the protocol static, DHCP, NONE,BOOTP used when starting the device
HWADDR the MAC address of the NIC
nm_controlled nm is a shorthand for networkmanager and is recommended to set to No
Onboot On|off Whether this device is activated with OS boot
Type device types, Ethernet Bridge
Unique identifier of the UUID online device
IPADDR IP address of this interface
NETMASK Subnet Mask
Gateway Default Gateways
DNS1,DNS2,DNS3 DNS server address
Ipv6init Initializing IPv6 protocol address
Userctl whether to allow normal users to manage this interface
Peerdns when the value of Bootproto is DHCP, allows the DHCP server to provide a DNS server that points to
Override locally manually configured DNS servers to point to
Routing Management
Route view and Configure routing
The package name that provides this command net-tools
Add Routing route add [-net|-host] TARGET [netmask netmask] Dev IFNAME
Route add-net 192.56.76.0 netmask 255.255.255.0 Dev eth0
Route add-net 192.168.3.0 netmask 255.255.255.0 GW 172.16.0.1
Remove routing route del {-net|-host} TARGET
Route Del-net 192.168.3.0/24
This method of configuring routing takes effect only immediately, but does not take effect permanently
Configure Routing (permanent)
/etc/sysconfig/network-scripts/route-ifname
Defining formats
DESTINATION via GATEWAY [Dev IFNAME]
192.168.0.0/24 via 172.16.0.1
10.10.10.0/24 via 172.16.0.1 Dev ens33
10.1.1.0/24 via 172.16.0.1 Dev ens33
Configure host Name
echo "HOSTNAME" >/proc/sys/kernel/hostname
hostname hostname
Directly behind the host name can be directly modified, temporary effect
Permanent effective Modification method
/etc/sysconfig/network or/etc/hostname
Modify its configuration hostname permanent effect
Network Common Tools
Ping detects if the destination IP is up to
-C means sending several ping packets
-W Specifies the timeout length, in seconds
Traceroute IP
Detects gateway devices that reach the middle of the target host
MTR HOST
Network diagnostic tool incorporating ping and traceroute command functions
Netstat Network status Detection Tool
-R Display Routing table
-N Numeric digital display, do not reverse IP address to host name
-T TCP protocol-related connections
-u UDP protocol related connections
-L Listen shows a link that is in the listening state (that is, waiting for another process to connect)
-A Show All links
-P Displays the name and PID of the process associated to the associated connection
Common combinations:-rn,-TNL,-UNL,-TUNL,-tan,-TNLP
Ss
-N Numeric digital display, do not reverse IP address to host name
-T TCP protocol-related connections
-u UDP protocol related connections
-L Listen shows a link that is in the listening state (that is, waiting for another process to connect)
-A Show All links
-E Display Extended information
-m display socket memory usage information
-O State {established|fin_wait_1|fin_wait_2|listening}
Common combinations-tnl,-UNL,-tan,-TUNL,-TNLP
Iftop bandwidth consumption with connection-centric display
Nethogs Show bandwidth usage as a process-centric
Linux 18th Day Self-study network management