botang 发表于 2019-6-23 08:48:11

课程第31次

检查网络配置:
<font size="2">netstat -antp</font>Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address         Foreign Address         State       PID/Program name
tcp      0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd
tcp      0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      18199/X
tcp      0      0 192.168.122.1:53      0.0.0.0:*               LISTEN      18296/dnsmasq
tcp      0      0 0.0.0.0:22            0.0.0.0:*               LISTEN      7889/sshd
tcp      0      0 127.0.0.1:631         0.0.0.0:*               LISTEN      18143/cupsd
tcp      0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      8187/master
tcp      0    208 192.168.0.4:22          192.168.0.165:56697   ESTABLISHED 19914/sshd: root@pt
tcp6       0      0 :::111                  :::*                  LISTEN      1/systemd
tcp6       0      0 :::6000               :::*                  LISTEN      18199/X
tcp6       0      0 :::22                   :::*                  LISTEN      7889/sshd
tcp6       0      0 ::1:631               :::*                  LISTEN      18143/cupsd
tcp6       0      0 ::1:25                  :::*                  LISTEN      8187/master
静态固定配网络:

网络的配置文件:
1. 接口设备/etc/sysconfig/network-scripts/ifcfg-xxx
    xxx 是由模块(lsmod : e100; rmmod e1000;modprobe e1000)
   

DEVICE=xxx
IPADDR=10.10.10.10
NETMASK=255.255.255.0
GATEWAY=10.10.10.12. 名字服务器的客户端:
    /etc/resolv.conf:
search example.com
nameserver 192.168.0.1
nameserver 8.8.8.83. 自己的主机名:
/etc/hostname:
station4.example.comRHEL6含之前:
/etc/sysconfig/network:
HOSTNAME=station4.example.com4. 其他机器的主机名(没有DNS的时候认识其他主机使用,有DNS时,优先级也高于DNS)
/etc/hosts:
127.0.0.1localhost.localdomainlocahost
10.10.10.4 station4.example.comstation4
...............动态适应配网络:
NetworkManager/nmcli/nm-connection-editor
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
一个物理网卡,同时有多个IP地址:
# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu 1500
      inet 192.168.0.4netmask 255.255.255.0broadcast 192.168.0.255
      inet6 fe80::20c:29ff:fe8c:a433prefixlen 64scopeid 0x20<link>
      ether 00:0c:29:8c:a4:33txqueuelen 1000(Ethernet)
      RX packets 5915bytes 741821 (724.4 KiB)
      RX errors 0dropped 0overruns 0frame 0
      TX packets 1857bytes 385845 (376.8 KiB)
      TX errors 0dropped 0 overruns 0carrier 0collisions 0

ens33:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu 1500
      inet 192.168.0.104netmask 255.255.255.0broadcast 192.168.0.255
      ether 00:0c:29:8c:a4:33txqueuelen 1000(Ethernet)

lo: flags=73<UP,LOOPBACK,RUNNING>mtu 65536
      inet 127.0.0.1netmask 255.0.0.0
      inet6 ::1prefixlen 128scopeid 0x10<host>
      looptxqueuelen 1000(Local Loopback)
      RX packets 2359bytes 156920 (153.2 KiB)
      RX errors 0dropped 0overruns 0frame 0
      TX packets 2359bytes 156920 (153.2 KiB)
      TX errors 0dropped 0 overruns 0carrier 0collisions 0
# pwd
/etc/sysconfig/network-scripts
# ls
ifcfg-ens33      ifdown-isdn      ifup-bnep   ifup-routes
ifcfg-ens33:0    ifdown-post      ifup-eth    ifup-sit
ifcfg-ens33.bakifdown-ppp       ifup-ib   ifup-Team
ifcfg-lo         ifdown-routes    ifup-ippp   ifup-TeamPort
ifdown         ifdown-sit       ifup-ipv6   ifup-tunnel
ifdown-bnep      ifdown-Team      ifup-isdn   ifup-wireless
ifdown-eth       ifdown-TeamPortifup-plip   init.ipv6-global
ifdown-ib      ifdown-tunnel    ifup-plusbnetwork-functions
ifdown-ippp      ifup             ifup-post   network-functions-ipv6
ifdown-ipv6      ifup-aliases   ifup-ppp
# cat ifcfg-ens33
DEVICE=ens33
IPADDR=192.168.0.4
NETMASK=255.255.255.0
# cat ifcfg-ens33
DEVICE=ens33
IPADDR=192.168.0.4
NETMASK=255.255.255.0
#





页: [1]
查看完整版本: 课程第31次