Basic router configuration, static routing

static route

Static routing (English: Static  routing) is a routing method in which routing entries are manually configured rather than dynamically determined. Unlike dynamic routing, static routing is fixed and does not change even if network conditions change or are reconfigured. Generally speaking, static routes are added to the routing table item by item by the network administrator.

  • 1. Switching of router configuration mode

Router>                                      //用户模式
Router>enable                                //进入特权模式
Router#configure terminal                    //进入全局配置模式
Router(config)#interface fastEthernet 0/0    //进入端口配置模式
Router(config-if)#exit                       //返回上一级
Router(config)#end                           //返回特权模式
Router#write                                 //保存配置
  • 2. Router basic configuration commands

Router(config)#interface fastEthernet 0/0                //进入f0/0接口
Router(config-if)#ip add 202.128.1.1 255.255.255.0       //为接口设置ip地址
                  Ip add   ip地址   子网掩码
Router(config-if)#no ip add 202.128.1.1 255.255.255.0    //删除已设置的IP地址
Router(config-if)#encapsulation ppp                      //封装ppp协议
Router(config-if)#no shutdown                            //开启接口
Router(config-if)#shutdown                               //关闭接口

 

3. Static routing configuration commands

Ip route target network segment subnet mask next hop (you can set the interface or configure the next hop ip address)

Router(config)#ip route 192.168.1.0 255.255.255.0 f0/0

Router(config)#ip route 0.0.0.0 0.0.0.0 f0/0 //0.0.0.0 represents all network segments            

experiment:

Topology:

Three routers, one server, one pc

The routes are named RA, RB, and RC respectively, and RA and RB are connected by serial port

Requirement: Use the above commands to realize interoperability across the network

configuration

We first add modules to the router. If you want to add modules, you need to power off the router first.

RA and RB are added separately and connected by serial cable

Then we configure ip for each routing interface and open the interface

RA

F0/0

Router(config)#interface f0/0 //Enter the interface

Router(config-if)#ip add 202.128.1.1 255.255.255.0 //Set ip for the interface

Router(config-if)#no shutdown //Open interface

 

Se0/0

Router(config)#int se0/0 //Enter interface

Router(config-if)#ip add 1.1.1.1 255.255.255.0 //Set ip

Router(config-if)#no shutdown //Open interface

Router(config-if)#encapsulation ppp //encapsulation protocol (this needs to be configured with serial port link)

Other routing configurations are similar, so I won’t demonstrate them one by one here.

RB

RC

After configuration, let's test it

Here it shows that the target host is unreachable, because we have not configured static routing (the router does not know how to forward when changing the network segment)

Static routing configuration

Static routing is to guide the router, and the static routing specifies which interface the IP segment comes from

RA

Router(config)#ip route 10.1.1.0 255.255.255.0 se0/0

Router(config)#ip route 192.168.1.0 255.255.255.0 se0/0

RB

Router(config)#ip route 192.168.1.0 255.255.255.0 f0/0

Router(config)#ip route 202.128.1.0 255.255.255.0 se0/0

RC

The default route used here means that no matter which network segment comes from here, it is generally used on the end route

Router(config)#ip route 0.0.0.0 0.0.0.0 f0/1

Ok, the configuration is complete

have a test

It is already possible to communicate with the whole network

Guess you like

Origin blog.csdn.net/m0_73910867/article/details/127819125