日本高清免费一本视频100禁_在线不卡欧美精品一区二区三区_国产一区二区好的精华液_中文综合在线_国产啊啊啊视频在线观看_大地资源网免费观看高清

IT之道-艾銻知道

Linux操作系統(tǒng)基礎(chǔ)的網(wǎng)絡(luò)管理知識(shí)-服務(wù)器運(yùn)維


2020-05-27 16:18 作者:艾銻無(wú)限 瀏覽量:

Linux操作系統(tǒng)基礎(chǔ)的網(wǎng)絡(luò)管理知識(shí)-服務(wù)器運(yùn)維

 

 
艾銻無(wú)限是一家專門(mén)做企業(yè)網(wǎng)管外包服務(wù)的機(jī)構(gòu),通過(guò)線上+線下結(jié)合的服務(wù)方式,為企業(yè)提供電腦維修、辦公設(shè)備維護(hù)、系統(tǒng)維護(hù)、網(wǎng)絡(luò)與數(shù)據(jù)安全、服務(wù)器運(yùn)維等專業(yè)的網(wǎng)管服務(wù)外包公司
 
IT服務(wù) (1) 網(wǎng)絡(luò)狀態(tài)查看
在Linux中經(jīng)常使用ifconfig,route和netstat查看網(wǎng)絡(luò)狀態(tài),它們就是. net-tools工具,下面我來(lái)使用下。
IMG_256
IMG_257
我就說(shuō)下ifconfig和route。
在我們的linux中有很多網(wǎng)卡接口,比如eth0第一塊網(wǎng)卡網(wǎng)絡(luò)接口,eno1板載?網(wǎng)卡, ens33 PCI-E?網(wǎng)卡 。CentOS 7 使?用了?致性?絡(luò)設(shè)備命名,以上都不匹配,則使? eth0
  1. [root@node01 ~]# ifconfig eth0 
  2. eth0: error fetching interface information: Device not found 
  3. [root@node01 ~]# ifconfig ens33 
  4. ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500 
  5.         inet 192.168.92.90  netmask 255.255.255.0  broadcast 192.168.92.255 
  6.         inet6 fe80::b889:1772:c306:ef8f  prefixlen 64  scopeid 0x20<link>
  7.         ether 00:0c:29:07:43:5a  txqueuelen 1000  (Ethernet) 
  8.         RX packets 910  bytes 954985 (932.6 KiB) 
  9.         RX errors 0  dropped 0  overruns 0  frame 0 
  10.         TX packets 450  bytes 38942 (38.0 KiB) 
  11.         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 
IT服務(wù)(2) 網(wǎng)絡(luò)配置文件
ifcfg-eth0,/etc/hosts
在配置hadoop,elasticsearch集群的時(shí)候需要在/etc/hosts配置集群IP和主機(jī)名,有時(shí)候你ping不了百度,可能域名解析不了,需要在/etc/sysconfig/network-scripts/ifcfg-eth0配置
  1. [root@node01 ~]# vim /etc/sysconfig/network 
  2. ######### 
  3. HOSTNAME=node01 
  4. [root@node01 ~]# vim /etc/hosts 
  5. ######### 
  6. 192.168.92.90 node01 
  7. 192.168.92.91 node02 
  8. 192.168.92.92 node03 
  9.  
  10. [root@node01 ~]# 配置DNS,域名解析服務(wù) 
  11. [root@node01 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 
  12. DNS1=202.106.0.20 
  13. DNS2=8.8.8.8 
IT服務(wù)(3) 故障排除命令
第一,ping百度:查看目標(biāo)機(jī)器的網(wǎng)絡(luò)是否可通
  1. maoli@ubuntu:~$ ping baidu.com 
  2. PING baidu.com (220.181.38.148) 56(84) bytes of data. 
  3. 64 bytes from 220.181.38.148: icmp_seq=1 ttl=128 time=49.6 ms 
  4. 64 bytes from 220.181.38.148: icmp_seq=2 ttl=128 time=48.2 ms 
  5. ^C 
  6. --- baidu.com ping statistics --- 
  7. 2 packets transmitted, 2 received, 0% packet loss, time 1001ms 
  8. rtt min/avg/max/mdev = 48.223/48.948/49.673/0.725 ms 
traceroute
  • nslookup:nslookup www.baidu.com Server即為域名對(duì)應(yīng)的ip
    1. maoli@ubuntu:~$ nslookup www.baidu.com 
    2. Server:     127.0.1.1 
    3. Address:    127.0.1.1#53 
    4.  
    5. Non-authoritative answer: 
    6. www.baidu.com   canonical name = www.a.shifen.com. 
    7. Name:   www.a.shifen.com 
    8. Address: 182.61.200.6 
    9. Name:   www.a.shifen.com 
    10. Address: 182.61.200.7 
  • telnet:如果ip是可達(dá)的,但是服務(wù)仍有然有問(wèn)題,則可以通過(guò)telnet去查看服務(wù)端口狀態(tài)
  • tcpdump:tcpdump -i any -n port 80 # 抓取所有網(wǎng)卡(any)80端口數(shù)據(jù)包,并且以ip形式顯示(-n)
    1. maoli@ubuntu:~$ sudo tcpdump -i any -n port 80 -n 
    2. tcpdump: verbose output suppressed, use -v or -vv for full protocol decode 
    3. listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes 
    4. 10:28:11.003675 IP 192.168.92.1.53951 > 192.168.92.135.80: Flags [S], seq 185886164, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0 
    5. 10:28:11.003875 IP 192.168.92.135.80 > 192.168.92.1.53951: Flags [S.], seq 2863640054, ack 185886165, win 64240, options [mss 1460,nop,nop,sackOK,nop,wscale 7], length 0 
    6. 10:28:11.004114 IP 192.168.92.1.53951 > 192.168.92.135.80: Flags [.], ack 1, win 4106, length 0 
    7. 10:28:11.010472 IP 192.168.92.1.53951 > 192.168.92.135.80: Flags [P.], seq 1:476, ack 1, win 4106, length 475: HTTP: GET /sqli-labs/ HTTP/1.1 
  • tcpdump -i any -n host 10.0.0.1 and port 80# 抓取所有網(wǎng)卡的80端口和10.0.0.1之間的數(shù)據(jù)包,并且以ip形式顯示
  • netstat 查看服務(wù)監(jiān)聽(tīng)端口狀態(tài)是否正確 -n 顯示ip地址 -t tcp協(xié)議 -p 顯示端口對(duì)應(yīng)的進(jìn)程 -l tcp的監(jiān)聽(tīng)狀態(tài)(listen) -ntpl 查看端口開(kāi)放情況
    1. maoli@ubuntu:~$ sudo netstat -ntlp 
    2. 激活I(lǐng)nternet連接 (僅服務(wù)器) 
    3. Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name 
    4. tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1111/sshd        
    5. tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      14200/cupsd      
    6. tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1148/mysqld      
    7. tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      1165/redis-server 1 
    8. tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1285/dnsmasq     
    9. tcp6       0      0 :::22                   :::*                    LISTEN      1111/sshd        
    10. tcp6       0      0 ::1:631                 :::*                    LISTEN      14200/cupsd      
    11. tcp6       0      0 :::9000                 :::*                    LISTEN      2234/docker-proxy 
    12. tcp6       0      0 :::80                   :::*                    LISTEN      1842/apache2  
IT服務(wù)(4) 網(wǎng)絡(luò)服務(wù)管理
?絡(luò)服務(wù)管理程序分為兩種,分別為SysV和systemd。現(xiàn)在Systemd已經(jīng)基本取代了SysV的Init。
IMG_258
IT服務(wù)(5) 設(shè)置靜態(tài)ip
在搭建任何集群,都是要設(shè)置靜態(tài)ip的。
  1. [root@node01]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 
  2.  
  3. ################ 
  4. BOOTPROTO=static 
  5. ONBOOT="yes" 
  6. # 網(wǎng)關(guān)地址根據(jù)系統(tǒng)的網(wǎng)絡(luò)而定 
  7. GATEWAY=192.168.92.2 
  8. # 設(shè)置的靜態(tài)ip 
  9. IPADDR=192.168.92.92 
  10. NETMASK=255.255.255.0 
  11. # 配置DNS服務(wù)器 
  12. DNS1=8.8.8.8 
  13. DNS2=8.8.4.4 

 

相關(guān)文章

IT外包服務(wù)
二維碼 關(guān)閉
主站蜘蛛池模板: 江口县| 台州市| 那坡县| 突泉县| 丹凤县| 宁南县| 汶川县| 景洪市| 宜春市| 马公市| 子洲县| 海宁市| 九龙坡区| 绥化市| 尼木县| 颍上县| 北碚区| 湟源县| 柘荣县| 德格县| 葫芦岛市| 新竹县| 铁岭市| 中方县| 壤塘县| 昌宁县| 楚雄市| 天水市| 拜泉县| 无棣县| 苍梧县| 丹寨县| 正宁县| 手游| 乌兰察布市| 慈溪市| 伊吾县| 芦山县| 木兰县| 玉龙| 枣庄市|