Initial commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
*~
|
||||||
|
*.env
|
||||||
|
docker-compose.yml
|
||||||
|
*.tar
|
||||||
|
*.gz
|
||||||
|
|
||||||
|
.vscode/
|
||||||
|
*.sublime*
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk add --no-cache curl wget git openssh bash vim nano socat bind-tools tcpdump python3 jq lldpd lighttpd iperf iperf3 lftp nmap fping pv
|
||||||
|
|
||||||
|
# Set environment variables for init script
|
||||||
|
ENV HTTP_SERVER_DISABLE=false
|
||||||
|
ENV HTTP_SERVER_PORT=80
|
||||||
|
|
||||||
|
RUN mkdir -p /docker-entrypoint-initdb.d
|
||||||
|
COPY --chown=root:root --chmod=755 src/init.sh /init.sh
|
||||||
|
|
||||||
|
# Additional files
|
||||||
|
COPY --chown=root:root --chmod=644 src/index.html /var/www/localhost/htdocs/index.html
|
||||||
|
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/init.sh" ]
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Welcome to lighttp!
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Setup HTTP Server
|
||||||
|
if [[ "$HTTP_SERVER_DISABLE" == "false" ]]; then
|
||||||
|
# Set Port
|
||||||
|
sed -i "s/^.*server\.port.*/server.port = $HTTP_SERVER_PORT/" /etc/lighttpd/lighttpd.conf
|
||||||
|
|
||||||
|
# Start lighttpd
|
||||||
|
lighttpd -f /etc/lighttpd/lighttpd.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start LLDP Deamon
|
||||||
|
lldpd
|
||||||
|
|
||||||
|
# Work through entrypoint scripts
|
||||||
|
find /docker-entrypoint-initdb.d/ -type f -executable -exec /bin/sh {} \;
|
||||||
|
|
||||||
|
# Open Shell for User
|
||||||
|
/bin/sh
|
||||||
Reference in New Issue
Block a user