A router is a layer-3 device, and the most important thing at layer-3 isip
So ip
you need to know the basics
IP
address classification- Variable-length subnet mask
By using a variable-length subnet mask, networks with the same network number (adjacent ip, different blocks) can use different masks,
which can saveIP
addresses and make full use of the effectiveIP
address space. - Use network address translation
NAT
NAT
(Network Address Translation
) to translate internal private addresses into external legal global addresses ,
so that users who do not have legalIP
addresses can access the external Internet through NAT . - Static route
By configuring static route, users can manually specify the path to be passed when accessing a certain network . Static route is adopted when the network structure is relatively simple and the path to a certain network is generally unique .
Basic Configuration - Common Commands
effect | Order |
---|---|
Physical Line Setup | line type number |
Set up static routes | ip route destination subnet-mask next-hop |
start IP routing |
ip routing |
NAT configuration
effect | Order |
---|---|
Define a global address pool | ip nat pool name start-ip end-ip {netmask netmask or prefix-length prefix-length} [type rotary] |
define a standard access list | access-list access-list-number permit source [source-wildcard] |
Build dynamic address translation (internal ip access table mapping external ip pool) |
ip nat inside source {list {access-list-number or name} pool name [overload] or static local-ip global-ip} |
Specify internal and external ports | ip nat {inside or outside} |
Static routing configuration
effect | Order |
---|---|
Create a static route | ` ip route prefix mask {address |
annotation
logo Express Prefix
The part of the destination network to be reached mask
subnet mask address
The address of the next hop IP
, that is, the port address of the adjacent router (equivalent to the interface number of the router itself).interface
local network interface distance
Administrative distance (optional) tag tag
tag
weight (optional)permanent
Specifies that this route will not be removed even if the port is down.
The configuration result is the same, next hop ip
a physical interface connected to the destination network with itself
If the router is not connected to other routers, it can also be assigned a default route to replace the static route to all network parts, that is, as long as no path to a specific destination address is
found in the routing table , the data will be routed to the address on the adjacent router.192.168.2.1