106 lines
2.3 KiB
Markdown
106 lines
2.3 KiB
Markdown
# Network Alpine
|
|
|
|
Just an alpine image with common packages for network troubleshooting installed:
|
|
|
|
* General Stuff
|
|
* bash
|
|
* wget
|
|
* jq
|
|
* pv
|
|
* git
|
|
* vim
|
|
* nano
|
|
* python3
|
|
* Querying Common Protocols
|
|
* curl
|
|
* openssh
|
|
* lftp
|
|
* Network Serving
|
|
* lighttpd
|
|
* lldpd
|
|
* Network Query
|
|
* bind-tools (dig)
|
|
* tcpdump
|
|
* socat
|
|
* iperf, iperf3
|
|
* nmap
|
|
* fping
|
|
|
|
By default a HTTP Server is available on port 80. Change the port with `HTTP_SERVER_PORT`.
|
|
|
|
> [!CAUTION]
|
|
> This is only meant to be used inside testing networks. Do NOT use for production!
|
|
|
|
## Example Use Cases
|
|
|
|
```bash
|
|
# See current IP configuration
|
|
ip address
|
|
ip route
|
|
|
|
# Set IP address
|
|
ip address add 10.1.1.3/24 dev eth0
|
|
ip address add broadcast 10.1.2.255 dev eth0
|
|
|
|
# Set Gateway
|
|
ip route del default
|
|
ip route add default 10.1.1.0/24 via 10.1.1.3
|
|
|
|
# Request new IP address via DHCP
|
|
ip addr flush dev eth0
|
|
udhcpc -i eth0 -n -q
|
|
|
|
# Set DNS
|
|
nano /etc/resolv.conf # Update line "namesperver x.x.x.x"
|
|
|
|
# Query DNS
|
|
dig example.com A @10.1.1.3
|
|
|
|
# List LLDP neighbors
|
|
lldpcli show neighbors
|
|
|
|
# Ping a host
|
|
ping -I eth0 10.1.1.3
|
|
|
|
# Send HTTP Request
|
|
curl http://10.1.1.3 -v
|
|
|
|
# Connect somewhere via SSH
|
|
ssh user@10.1.1.3 -p 22
|
|
# Copy file via SFTP
|
|
scp file.txt user@10.1.1.3:~
|
|
|
|
# Interactively browse FTP server
|
|
lftp ftp://user@10.1.1.3
|
|
|
|
# Connect to a TCP port
|
|
nc 10.1.1.3 80
|
|
|
|
# Scan for open TCP ports
|
|
nmap -sT -p 22-10000 10.1.1.3
|
|
|
|
# Ping all IPs in the network
|
|
fping -g -r 1 -q -a 10.1.1.0/24
|
|
|
|
# Capture network traffic
|
|
tcpdump # Capture ALL traffic
|
|
tcpdump -i eth0 icmp # Filter for ICMP traffic
|
|
tcpdump -i eth0 -w capture.pcap # Write to file
|
|
tcpdump -r capture.pcap # Read from file
|
|
|
|
# Test unicast bandwidth
|
|
iperf3 -s # Setup server on host 10.1.1.2
|
|
iperf3 -c 10.1.1.2 # Check TCP downlink from 10.1.1.2
|
|
iperf3 -c 10.1.1.2 -u # Check UDP downlink from 10.1.1.2
|
|
|
|
# Test multicast connectivity (with iperf)
|
|
iperf -s -u -B 224.0.67.67 -i 1 # Setup multicast receiver
|
|
iperf -c 224.0.67.67 -u --ttl 5 -t 10 -b 1M # Send for 10 seconds at 1 MBit/s
|
|
|
|
# Test multicast connectivity (with socat)
|
|
seq 50 | xargs -Iz echo "Hello World" | pv -qL 2 | socat -u - UDP4-DATAGRAM:239.255.10.10:5000,ip-multicast-ttl=1 # Sender
|
|
socat -u UDP4-RECV:5000,ip-add-membership=239.255.10.10:0.0.0.0 - # Receiver
|
|
|
|
|
|
```
|