Ubuntu檢視當前IP位址及其它網路命令

2021-06-19 00:59:25 字數 2893 閱讀 5363

ifconfig eth0 |awk '/inet/ '

網路

根據ip查網絡卡位址

arping ip位址

根據ip查電腦名

nmblookup -a ip位址

檢視當前ip位址

ifconfig eth0 |awk '/inet/ '

檢視當前外網的ip位址

w3m -no-cookie -dump www.123cha.com|grep -o '[0-9]\\.[0-9]\\.[0-9]\\.[0-9]\'

w3m -no-cookie -dump ip.loveroot.com|grep -o '[0-9]\\.[0-9]\\.[0-9]\\.[0-9]\'

檢視當前監聽80埠的程式

lsof -i :80

檢視當前網絡卡的實體地址

ifconfig eth0 | head -1 | awk ''

同乙個網絡卡增加第二個ip位址

#在網絡卡eth0上增加乙個1.2.3.4的ip:

sudo ifconfig eth0:0 1.2.3.4 netmask 255.255.255.0

#刪除增加的ip:

sudo ifconfig eth0:0 down

立即讓網路支援nat

echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

sudo iptables -t nat -i postrouting -j masquerade

檢視路由資訊

netstat -rn

sudo route -n

手工增加一條路由

sudo route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1

手工刪除一條路由

sudo route del -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1

修改網絡卡mac位址的方法

sudo ifconfig eth0 down #關閉網絡卡

sudo ifconfig eth0 hw ether 00:aa:bb:cc:dd:ee #然後改位址

sudo ifconfig eth0 up #然後啟動網絡卡

永久改位址方法

sudo gedit /etc/network/inte***ces

在 iface eth0 inet static 後面新增一行:

pre-up ifconfig eth0 hw ether 01:01:01:01:01:01

配置檔案應該像如下

iface eth0 inet static

pre-up ifconfig eth0 hw ether 01:01:01:01:01:01

address 192.168.1.10

netmask 255.255.255.0

gateway 192.168.1.1

最後是 logout 或者reboot

統計當前ip連線的個數

netstat -na|grep established|awk ''|awk -f: ''|sort|uniq -c|sort -r -n

netstat -na|grep syn|awk ''|awk -f: ''|sort|uniq -c|sort -r -n

統計當前20000個ip包中大於100個ip包的ip位址

tcpdump -tnn -c 20000 -i eth0 | awk -f "." '' | sort | uniq -c | sort -nr | awk ' $1 > 100 '

遮蔽ipv6

echo "blacklist ipv6" | sudo tee /etc/modprobe.d/blacklist-ipv6

察看當前網路連線狀況以及程式

sudo netstat -atnp

檢視網路連線狀態

netstat -n | awk '/^tcp/ end '

檢視當前系統所有的監聽埠

nc -zv localhost 1-65535

檢視網路的當前流量

#安裝 ethstatus 軟體

sudo apt-get install ethstatus

#檢視 adsl 的速度

sudo ethstatus -i ppp0

#檢視 網絡卡 的速度

sudo ethstatus -i eth0

#或安裝 bwm-ng

sudo apt-get install bwm-ng

#檢視當前網路流量

bwm-ng

檢視網域名稱的註冊備案情況

檢視到某乙個網域名稱的路由情況

重新從伺服器獲得ip位址

sudo dhclient

從當前頁面開始映象整個**到本地

wget -r -p -np -k

· -r:在本機建立伺服器端目錄結構;

· -k: 轉換非相對鏈結為相對鏈結。

sudo apt-get install axel

axel -n 5 或者

lftp -c "pget -n 5 「

如何檢視http頭

w3m -dump_head

或 curl --head

快速使用http方式共享目錄

#進入需要共享的目錄後執行:

#其它電腦使用http://ip:8000 來訪問

#自定義埠為8080:

原址:

Ubuntu檢視當前IP位址

ifconfig eth0 awk inet 截圖 arping ip位址 nmblookup a ip位址 ifconfig eth0 awk inet w3m no cookie dump www.123cha.com grep o 0 9 0 9 0 9 0 9 w3m no cookie d...

Ubuntu下配置IP位址及DNS

方法一 通過 etc network inte ces,在它的最後增加一句 多個dns之間用空格分隔 inte ces 5 file used by ifup 8 and ifdown 8 include files from etc network inte ces.d source direct...

獲取當前人IP位址

獲取訪問的ip位址 date 2018年11月26日上午11 31 49 對於通過多個 的情況,第乙個ip為客戶端真實ip,多個ip按照 分割 if ipaddress null ipaddress.length 15 return ipaddress 只需要把request的引數傳進去就可以拿到i...