|
检查网络配置:
- <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.1
复制代码 2. 名字服务器的客户端:
/etc/resolv.conf:
- search example.com
- nameserver 192.168.0.1
- nameserver 8.8.8.8
复制代码 3. 自己的主机名:
/etc/hostname:
RHEL6含之前:
/etc/sysconfig/network:
- HOSTNAME=station4.example.com
复制代码 4. 其他机器的主机名(没有DNS的时候认识其他主机使用,有DNS时,优先级也高于DNS)
/etc/hosts:
- 127.0.0.1 localhost.localdomain locahost
- 10.10.10.4 station4.example.com station4
- ...............
复制代码 动态适应配网络:
NetworkManager/nmcli/nm-connection-editor
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
一个物理网卡,同时有多个IP地址:
- [root@station4 network-scripts]# ifconfig
- ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- inet 192.168.0.4 netmask 255.255.255.0 broadcast 192.168.0.255
- inet6 fe80::20c:29ff:fe8c:a433 prefixlen 64 scopeid 0x20<link>
- ether 00:0c:29:8c:a4:33 txqueuelen 1000 (Ethernet)
- RX packets 5915 bytes 741821 (724.4 KiB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 1857 bytes 385845 (376.8 KiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- ens33:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- inet 192.168.0.104 netmask 255.255.255.0 broadcast 192.168.0.255
- ether 00:0c:29:8c:a4:33 txqueuelen 1000 (Ethernet)
- lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
- inet 127.0.0.1 netmask 255.0.0.0
- inet6 ::1 prefixlen 128 scopeid 0x10<host>
- loop txqueuelen 1000 (Local Loopback)
- RX packets 2359 bytes 156920 (153.2 KiB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 2359 bytes 156920 (153.2 KiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
复制代码- [root@station4 network-scripts]# pwd
- /etc/sysconfig/network-scripts
- [root@station4 network-scripts]# ls
- ifcfg-ens33 ifdown-isdn ifup-bnep ifup-routes
- ifcfg-ens33:0 ifdown-post ifup-eth ifup-sit
- ifcfg-ens33.bak ifdown-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-TeamPort ifup-plip init.ipv6-global
- ifdown-ib ifdown-tunnel ifup-plusb network-functions
- ifdown-ippp ifup ifup-post network-functions-ipv6
- ifdown-ipv6 ifup-aliases ifup-ppp
- [root@station4 network-scripts]# cat ifcfg-ens33
- DEVICE=ens33
- IPADDR=192.168.0.4
- NETMASK=255.255.255.0
- [root@station4 network-scripts]# cat ifcfg-ens33
- DEVICE=ens33
- IPADDR=192.168.0.4
- NETMASK=255.255.255.0
- [root@station4 network-scripts]#
复制代码
|
|