Skip to content

Linux & Networking

Shell

explaineshell.com

shell

commands mentined duriing lecture

ip a

ip n = arp -a

n=neighbours

ip r

r = route

python3 -m http.server 8080

git

pimpmykali.sh in github

Routing explained

Do you know what’s less useful than a screen door on a submarine? A network with no routes.

Displaying existing routes

First things first. You never want to make a change to a route until you verify the existing conditions. To do this, simply run the following:

Display existing routes with route:

ipr

Display existing routes with ip:

[tcarrigan@rhel ~]$ ip route  show
default via 10.0.2.2 dev enp0s3 proto dhcp metric 100 
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 100 
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 

For a basic listing, I prefer the old school route command, but your mileage may vary.

Adding new routes

At times, you need to add new routes between devices. To do this, use the examples below.

Using route: # route add -net 10.0.2.0/24 gw 192.168.0.1 enp0s3

Here the syntax is: route add -net <network_address> gw <gatewayaddr> <interfacename>

Using ip:

# ip route add 10.0.2.0/24 via 192.168.0.1 dev enp0s

Removing routes

You can remove routes in a similar fashion.

Using route:

# route del -net 10.0.2.0/24 gw 192.168.0.1 enp0s3 The syntax is the same as the add command, except we are using del instead of add.

Using ip:

# sudo ip route del 10.0.2.0/24 via 192.168.0.1 dev enp0s3 Again, we are only altering the syntax slightly from the add command.

Adding a new default gateway

Another task you may need to accomplish is configuring traffic to flow to a gateway. To accomplish this, use the following commands.

Adding a new gateway with route:

# route add default gw 192.168.0.1 Adding a new gateway with ip:

# ip route add default via 192.168.0.1vim s
To verify that the new gateway is set, use the standard route command or ip route show.

Common Ports and Protocols

CommonPorts

The OSI Model

Please Do Not Throw Sausage Pizza Away

  1. P Physical - data, cables, cat6
  2. D Data - switching, mac addresses
  3. N Network - IP addresses, routing
  4. T Trasport -TCP/UDP
  5. S Session -session management
  6. P Presentation - WMV, JPEG, MOV
  7. A Application - HTTP, SMTP