:
Network Query NIC address based on IP AddressArping IP Address
Check the computer name based on the IP address
Nmblookup-a ip Address
View current IP Address
ifconfig eth0 |awk '/inet/ {split($2,x,":");print x[2]}'
View the IP address of the current Internet
w3m -no-cookie -dump www.123cha.com|grep -o '[0-9]/{1,3/}/.[0-9]/{1,3/}/.[0-9]/{1,3/}/.[0-9]/{1,3/}'
w3m -no-cookie -dump ip.loveroot.com|grep -o '[0-9]/{1,3/}/.[0-9]/{1,3/}/.[0-9]/{1,3/}/.[0-9]/{1,3/}'
View the program listening to port 80
lsof -i :80
View the physical address of the current Nic
ifconfig eth0 | head -1 | awk '{print $5}'
Add a second IP address for the same Nic
# Add a 1.2.3.4 IP address to the eth0 NIC:
Sudo ifconfig eth0: 0 1.2.3.4 netmask 255.255.255.0
# Delete an added IP Address:
Sudo ifconfig eth0: 0 down
Enable the network to support NAT now
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -I POSTROUTING -j MASQUERADE
View route information
netstat -rn
sudo route -n
Manually add a route
sudo route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
Manually delete a route
sudo route del -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
How to modify the MAC address of a NIC
Sudo ifconfig eth0 down # disable the NIC
Sudo ifconfig eth0 HW ether 00: AA: BB: CC: DD: ee # change the address
Sudo ifconfig eth0 up # Start the NIC
Permanent address change method
sudo gedit /etc/network/interfaces
Add a line after iface eth0 Inet static:
pre-up ifconfig eth0 hw ether 01:01:01:01:01:01
The configuration file should be as follows:
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
Finally, logout or reboot
Count the number of current IP connections
netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r -n
netstat -na|grep SYN|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r -n
Count the IP addresses of up to 20000 IP packets in the current 100 IP Packets
tcpdump -tnn -c 20000 -i eth0 | awk -F "." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | awk ' $1 > 100 '
Mask IPv6
echo "blacklist ipv6" | sudo tee /etc/modprobe.d/blacklist-ipv6
View the current network connection status and program
sudo netstat -atnp
View network connection status
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
View All listening ports of the current system
nc -zv localhost 1-65535
View Current Network Traffic
# Install ethstatus Software
Sudo apt-Get install ethstatus
# View the ADSL speed
Sudo ethstatus-I ppp0
# View the speed of the NIC
Sudo ethstatus-I eth0
# Or install BWM-ng
Sudo apt-Get install BWM-ng
# View the current network traffic
BWM-ng
View domain name registration information
whois baidu.cn
View the Routing Status of a domain name
tracepath baidu.cn
Obtain the IP address from the server again
sudo dhclient
Image the entire website to the local device starting from the current page
Http://www.21cn.com of wget-r-p-NP-K
·-R: Create a server directory structure on the local machine;
·-P: Download and display all images of HTML files;
·-NP: only download the contents of the specified directory and Its subdirectories of the target site;
·-K: convert non-relative links to relative links.
How to download multiple threads
Sudo apt-Get install Axel
Axel-N5 http://xxx.xxx.xxx.xxx/xxx.zip
Or
Lftp-c "pget-N 5 http://xxx.xxx.xxx.xxx/xxx.zip"
How to view HTTP headers
W3m-dump_head http://www.example.com
Or curl -- head http://www.example.com
Share directories over HTTP
# Enter the directory to be shared and run:
Python-M simplehttpserver
# Access from other computers via http: // ip: 8000
# Custom port 8080:
Python-M simplehttpserver 8080