Bo's Oracle Station

查看: 1713|回复: 0

课程第31次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-6-23 08:48:11 | 显示全部楼层 |阅读模式
检查网络配置:
  1. <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)

   

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

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

  13. lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
  14.         inet 127.0.0.1  netmask 255.0.0.0
  15.         inet6 ::1  prefixlen 128  scopeid 0x10<host>
  16.         loop  txqueuelen 1000  (Local Loopback)
  17.         RX packets 2359  bytes 156920 (153.2 KiB)
  18.         RX errors 0  dropped 0  overruns 0  frame 0
  19.         TX packets 2359  bytes 156920 (153.2 KiB)
  20.         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
复制代码
  1. [root@station4 network-scripts]# pwd
  2. /etc/sysconfig/network-scripts
  3. [root@station4 network-scripts]# ls
  4. ifcfg-ens33      ifdown-isdn      ifup-bnep   ifup-routes
  5. ifcfg-ens33:0    ifdown-post      ifup-eth    ifup-sit
  6. ifcfg-ens33.bak  ifdown-ppp       ifup-ib     ifup-Team
  7. ifcfg-lo         ifdown-routes    ifup-ippp   ifup-TeamPort
  8. ifdown           ifdown-sit       ifup-ipv6   ifup-tunnel
  9. ifdown-bnep      ifdown-Team      ifup-isdn   ifup-wireless
  10. ifdown-eth       ifdown-TeamPort  ifup-plip   init.ipv6-global
  11. ifdown-ib        ifdown-tunnel    ifup-plusb  network-functions
  12. ifdown-ippp      ifup             ifup-post   network-functions-ipv6
  13. ifdown-ipv6      ifup-aliases     ifup-ppp
  14. [root@station4 network-scripts]# cat ifcfg-ens33
  15. DEVICE=ens33
  16. IPADDR=192.168.0.4
  17. NETMASK=255.255.255.0
  18. [root@station4 network-scripts]# cat ifcfg-ens33
  19. DEVICE=ens33
  20. IPADDR=192.168.0.4
  21. NETMASK=255.255.255.0
  22. [root@station4 network-scripts]#
复制代码





回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-7 16:52 , Processed in 0.036116 second(s), 24 queries .

快速回复 返回顶部 返回列表