# Networking

## Routing

```
# Check Routes
sudo route

# Add route with route
sudo route add -net 192.168.222.0 netmask 255.255.255.0 gw 10.175.34.1 tap0

# Remove route with route
sudo route del -net 192.168.222.0 netmask 255.255.255.0 gw 10.175.34.1 tap0

# Add route with ip
sudo ip route add 192.168.222.0/24 via 10.175.34.1

# Remove route with ip
sudo ip route del 192.168.222.0/24 via 10.175.34.1
```

## Arp Spoofing

```
sudo apt-get install dsniff
sudo arpspoof

echo 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -i <INTERFACE> -t <TARGETSERVER> -r <TARGETCLIENT>
```

## Port Scanning

### Nmap

```
# Full port scan
nmap -sS -p- -A <host> -T5 -oN outputfilename

# Ping sweep
nmap -sn <host>

# Host discovery, no ping
nmap -n -sn -PS22,135,443,445 <host>

# DNS discovery
sudo nmap -sS -sU -p53 -n <host>
```

### Hping / Hping3

```
```

## DNS

```
nslookup
> server <IP>
> set q=NS (Or any other type, MX, A etc)
> <DNSName, eg google.com)

# Dig 
dig @<serverIP> <DNSname> -t AXFR +nocookie

# Host
host -t axfr <DNSName> <SERVERIP>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cheats.philkeeble.com/linux/networking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
