Both active and passive network devices are used to operate computing devices through different networks. Router is one of them, it searches for the shortest route to the desired device in the N segment of the network. From its correct configuration depends on the work of devices at the network level, both within the infrastructure and with external segments outside it.
In this article we will pay attention to the basic configuration, when connecting the router for the first time and the configuration of interfaces.
Basic commands and syntax
To work with the router OS, it is necessary to have an understanding of the basic commands that will be used in the work. As well as the modes of interaction with the network device. By default, the user authenticates to the environment without elevated privileges and is able to execute basic commands. Let's switch to privileged mode:
enable
Now the command pool is much wider, let's look at the basic navigation commands:
- config - takes the user to the configuration environment where all device configuration takes place;
- show running-config - displays the confirmed configuration of the device;
- password <value> - to change the password;
- show system - displays basic information about the device;
- show interface status - displays available interfaces;
- show ip interfaces - displays all configured interfaces;
The commands presented above can be executed in privileged mode, but there are some commands that are possible only in configuration mode. To do this, you can go to config and check them. Note that when entering the configuration of any parameter, it is necessary to exit after configuration with the exit command. Brief pool of settings:
- interfaces <value> - configure interface;
- hostname <value> - renames the host;
- banner login - configure login banner;
- shutdown/no shutdown - in the interface configuration there is an option to switch the interface off and on;
- ip ssh server - enable ssh server on the device.
Let's move on to the router and consider in practice how these commands can be applied.
Configuring the router
If you don't have sufficient resources than you can perform actions on powerful cloud servers. Serverspace provides isolated VPS / VDS servers for common and virtualize usage.
Let's assume that we need to configure a connection between two routers according to the following scheme:
When logging in with a basic account, you must change the default password by entering the command:
password <value>
Where instead of the value <value> will be your new password for authentication, after you need to write the changes to the temporary buffer:
commit
If you don't confirm the new config within 600 seconds, the data will be rolled back to the previous state:
confirm
Let's look through the interfaces available on the machine, which can be configured, as well as find out if they are up. To do this, run the command:
show ip interfaces
show interface status
The first command is responsible for viewing the already configured interfaces and the second command for the list of connected interfaces. There are two links available on the current device: gi 1/0/3 and gi 1/0/4. Let's assume that the first one will look into the LAN segment and the second one gi 1/0/4 into the WAN to another router. Let's go to the system configuration mode with the command:
config
Where we configure the device name and banners, then exit the configuration mode and confirm the changes made:
banner login "Welcome to ESR-1!"
banner exec "Admin mode"
hostname "ESR-1"
exit
commit
confirm
Then go back to configuration mode and go to the first interface gi 1/0/3, it is often necessary to split the interface into multiple sub-interfaces. If this is necessary, execute the command pool
interface gi 1/0/3
mode routerport
exit
First we put the main interface into routerport mode, then exit the interface configuration with the exit command. Then let's create a sub-interface:
interface gi 1/0/3.10
ip address 10.10.1.1/24
ip firewall disable
exit
If you need to configure a regular interface, use the command:
interface gi 1/0/3
ip address 10.10.1.1/24
ip firewall disable
exit
Let's consider the interface that will look at the WAN, let's pretend that the settings are provided via DHCP. To configure it, let's run a couple of commands:
interface gi 1/0/4
ip address dhcp
ip firewall disable
exit
Exit the configuration mode and before 600 seconds have elapsed from the first change apply the settings with the confirm command. Let's make sure that everything works properly and the settings are applied, for this purpose write:
show ip interfaces
Exit the configuration mode and before 600 seconds have elapsed from the first change apply the settings with the confirm command. Let's make sure that everything works properly and the settings are applied, for this purpose write:
config
interface <interface_number>
shutdown
The device can be switched on with the similar command no shutdown, after which it is ready for use. Similarly, you can configure a second router to organise a network connection or connect local devices to the LAN by selecting the desired network.