《Linux網路工具》練習題

2021-05-28 14:20:13 字數 2564 閱讀 7510

1)設定eth1網絡卡位址為192.168.0.11,子網為255.255.255.0,mtu的值為1500

參***:

ifconfig eth1 192.168.0.11 netmask 255.255.255.0 mtu 1500

2)用route來增加乙個路由,目的網段為192.168.1.0

參***:

route add -net 192.168.1.0 netmask 255.255.255.0 dev eth1

3)刪除以上建立的路由資訊

參***:

route del -net 192.168.1.0 netmask 255.255.255.0 dev eth1

4)加入預設閘道器192.168.0.2

參***:

route add default gw 192.168.0.2

5)刪除預設閘道器192.168.0.2

參***:

route del default gw 192.168.0.2

6)用ip命令來操作管理網路

6.1)用ip命令顯示eth1的介面資訊

6.2)關閉eth1網絡卡

6.3)更改eth1網絡卡代號為ckhitler,並檢視結果,將eth0網絡卡代號改回eth1

6.5)開啟eth1網絡卡

參***:

ip link show

ip -s link show eth1

ip link set eth1 down

ip link set eth1 name ckhiler

ip link show

ip link set ckhitler name eth1

ip link set eth1 up

7)啟用dhcp的client

參***:

dhclient eth0

8)ping閘道器位址192.168.0.1,判斷mtu包,是否在1000以內

參***:

ping -c 2 -s 1000 -m do 192.168.0.1

9)統計網路流量

參***:

iftop或

ifstat

10)追蹤到www.sina.com.cn的路由表

參***:

traceroute -n www.sina.com.cn

11)用netstat顯示埠資訊

11.1)顯示tcp/udp埠狀態為listen的資訊

11.2)顯示tcp/udp埠狀態為established的資訊

參***:

netstat -tunl

netstat -tun

12)用nslookup來查詢www.163.com網域名稱的正解資訊

參***:

nslookup www.163.com

13)用nslookup來查詢202.108.9.39位址的反解資訊

參***:

nslookup 202.108.9.39

14)用tcpdump來監視網路資料報資訊

14.1)只監視網絡卡eth0的網路資料報

14.2)只監視網絡卡eth0及埠25的網路資料報

14.3)只監視網絡卡eth0及埠25的網路資料報,並用16程序方式顯示

14.4)只監視網絡卡eth0及埠25和源位址為192.168.0.3的網路資料報,並用16程序方式顯示

14.5)只監視網絡卡eth0及埠25和源位址為192.168.0.3而長度為10240的網路資料報

14.6)只監視網絡卡eth0及埠25和源位址為192.168.0.3的網路資料報,以snarf的形式抓完整的資料報到/tmp/data.cap檔案

參***:

tcpdump -i eth0 -nn

tcpdump -i eth0 -nn port 25

telnet 192.168.1.12 25

tcpdump -i lo -nn -x 'port 25'

tcpdump -i eth0 -nn 'port 25 and src host 192.168.0.3' -x

tcpdump -i eth0 -s 10240 -nn 'port 25 and src host 192.168.0.3' -x

tcpdump -i eth0 -nn 'port 25 and src host 192.168.0.3' -s0 -w /tmp/data.cap

15)用nc命令監視本機位址埠22的資訊,並將資訊寫入test.txt檔案

參***:

nc -vv -o test.txt 192.168.0.12 22

16)用nmap掃瞄192.168.0.12位址的tcp/udp埠

參***:

nmap -stu 192.168.0.12

17)用nmap掃瞄192.168.0.0/24網段活躍的主機

參***:

nmap -sp 192.168.0.0/24

18)用nmap掃瞄192.168.0.0/24網段的埠,埠範圍在1-1024

參***:

nmap -p 1-1024 192.168.0.0/24

linux 網路工具

測試網路流量 1.nload 讓使用者可以分開來監控入站流量和出站流量。centos安裝 yum install nload y centos安裝 yum install iftop y 可測量通過每乙個套接字連線傳輸的資料 它採用的工作方式有別於nload。iftop使用pcap庫來捕獲進出網路介...

linux命令練習題

1 統計 usr bin 目錄下的檔案個數 ls usr bin wc l2 取出當前系統上所有使用者的shell,要求,每種shell只顯示一次,並且按順序進行顯示 cut d f7 etc passwd sort u3 取出 etc inittab檔案的第6行 head 6 etc initta...

Linux基礎練習題

案例 複製 刪除 移動 在目錄 opt下建立乙個子目錄 nsd 在目錄 opt nsd 建立檔案readme.txt,利用vim寫入內容 i love linux 將 etc passwd 和 etc resolv.conf同時拷貝到 opt nsd目錄下 將檔案 etc redhat releas...