Skip to content

Instantly share code, notes, and snippets.

@CallMarl
Last active April 16, 2020 14:20
Show Gist options
  • Save CallMarl/7070de2fb0f110db0ba47f6899538df0 to your computer and use it in GitHub Desktop.
Save CallMarl/7070de2fb0f110db0ba47f6899538df0 to your computer and use it in GitHub Desktop.
Linux networking command (debian)
# Display all know device with hostname if it's know
arp
# Display all entry about revelant hostname or ip
arp -a hostname
arp -a ipaddr
# Get the ip address of URL
dig www.google.com
# Display networking information
ip a
# Clean interface addresses
ip addr flush eth0
# Bring up the interface
# (if the hotplug option is activate, ask for dhcp serveur)
ifup eth0
# Bring down the interface
# (if the interface is connected by dhcp lease, remove the dhcp lease)
ifdown eth0
# show routing table
ip route list
# Display listening tcp port
netstat -tnlp
# Display listenig udp port
netstat -unlp
# Display Ipv4 only
netstat -utnlp4
# Scan port to 1024
nmap 127.0.0.1
# Scan port range
nmap -p 0-65535
# Scan local network
nmap -T4 -sP 192.168.1.0/24
apt-get install -y \
net-tools \
tcpdump \
dnsutils \
nmap
# Try to join specific ip
ping 8.8.8.8
# Check dns by ping with domaine name
ping www.google.com
# Flood with ping (run as administatoe only)
ping -f 127.0.0.1
# Ping one time
ping -c 1 8.8.8.8
# Display the current route
route -n
# Adding routing rule
route add -net 192.168.2.0 gw 0.0.0.0 dev eth0
# Removing routing rule
route del -net 192.168.2.0 gw 0.0.0.0 dev eth0
# Dump all trafic
tcpdump
# Dump all trafic except ssh port
tcpdump not port 22
# Dump trafic of specific interface
tcpdump -i eth0
tcpdump -i eth0 not port 22
# Dump specific ports
tcpdump port 80 and port 443
tcpdump port 53
# Dump arp traffic
tcpdump -i eth0 arp
# Set verbosity from 1 to 6
tcpdump -v
tcpdump -vvvvvv
# Display paquet content ascii
tcpdump -i eth0 -A
# Display pasquet content hex + ascii
tcpdump -i eth0 -X
# Store dump in file
tcpdump -w dump.pcap
# Traceroute to destination
traceroute 8.8.8.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment