Have ideal, have ambition, believe in the near future, you will succeed!

Open wechat search [children go to school], pay attention to this is not the same programmer.

  • 1.1 overview,
  • 1.2, gateway
  • 1.3 Default Gateway
  • 1.4. Gateway value
  • 2.1. Port number
  • 2.2. Introduction to common port numbers
  • 2.3 MAC Address
  • 2.4 IP address
  • 2.5. Physical vs logical (IP) addresses
  • 3.1 what is routing
  • 3.2. Routing Table
  • 3.3 Static route and Dynamic Route

A, gateway

1.1 overview,

For a host connected to a network using TCP/IP, TCP/IP must know three things in order to successfully communicate with other network connections

  • The IP address
  • The default gateway
  • Subnet mask
Viewing IP Addresses

As shown above, you’ll see three important pieces of information: ipv4 address, subnet mask, default gateway; The default gateway and subnet mask are the same on the same subnet.

1.2, gateway

A gateway is a “gateway” from one network to another. It’s essentially an IP address from one network to another. Interfaces between different networks. A forwarding point from one network to another.

1.3 Default Gateway

If IP addresses on different networks want to communicate with each other, they must rely on gateways. This is done by routers, or Layer 3 devices.

Default gateway: Just like a room with multiple doors, a host can have multiple gateways. The default gateway means that if a host cannot find a available gateway, it sends packets to the default gateway.

1.4. Gateway value

The value of the gateway is usually the last IP address in the network segment.

MAC, IP, and Port addresses

Three addresses are essential if data is to be able to communicate properly on the network.

  • The port number
  • The IP address
  • The MAC address

2.1. Port number

The purpose of the port number is to enable various application processes at the application layer to send their data down to the transport layer through the port, and to let the transport layer know that the data in its message segment should be sent up to each application process at the application layer. In this sense, each port is equivalent to each application process.

Matters needing attention

  • The port number is identified by a 16bit port number.
  • The port number has local meaning only. That is, the port number only identifies the processes at the application layer of the local computer. There is no connection between the same port number for different computers on the Internet.

Generally speaking, there are three types of port numbers:

  • Recognized ports: 0 to 1023, which are tightly bound to several services. Often these port communications clearly indicate the protocol of a service. For example, port 80 is used for HTTP (Hypertext Transfer Protocol) communication.
  • Registration port: 1024 to 49151. They are loosely bound to a few services. That is, many services bind these ports. For example, many systems process dynamic ports starting at around 1024.
  • Dynamic port or private port: 49152 to 65535. In theory, these ports should not be assigned to services. The machine actually starts allocating dynamic ports at 1024.

2.2. Introduction to common port numbers

02

21 FTP transfer protocol

23 Telnet Remote Login

25 SMTP Simple file transfer Protocol

53 DNS Domain name resolution protocol

80 HTTP hypertext transfer protocol

119 NNTP Network news transmission protocol

161 SNMP Simple network management protocol

8000, 8001 PORT of the QQ server

2.3 MAC Address

Each device on the network has a unique address – a MAC address, also called a physical address, or a nic address.

A MAC address consists of 48 bits, usually in 12-bit hexadecimal format

The first six hexadecimal digits are generally distributed uniformly by IEEE to determine vendor uniqueness

The last six hexadecimal digits are managed by each vendor

Viewing MAC Addresses

04

2.4 IP address

IP addresses work at the network layer and complete packet addressing

06

2.5. Physical vs logical (IP) addresses

Physical address

  • Solidify on physical devices
  • Each port has only one physical address
  • Used when accessing physical media

Network (IP address)

Set in the software system

Each port number can have multiple network addresses

Used for internetwork addressing.

3. Router

The device used for routing on the Internet, or the device that implements routing, is called a router.

Key functions of the router:

  • Check the destination of the packet

  • Identify information sources

  • Possible routes were discovered. Procedure

  • Select the best route

  • Verify and maintain routing information

3.1 what is routing

A route is the information that guides the sending of IP packets

05

3.2. Routing Table

Routers rely on routing tables to forward data. The routing table is like a map. It contains information to each route. Each information contains at least three contents:

  • Destination network: indicates the network address that can be reached by the router
  • Next hop: Generally, the next hop points to the interface address of the next router destined for the destination network, which is called the next hop router.
  • Outbound interface: Indicates the interface through which packets are sent.

3.3 Static route and Dynamic Route

The static route selection algorithm is a non-adaptive routing algorithm. It is an immeasurable and simple routing algorithm that makes decisions according to certain fixed rules without using network status information. It relies on manual input information to configure the routing table. Static routes are private by default and therefore secure.

Static routing

  • Route manually specified by the network administrator
  • When the network topology changes, the administrator needs to manually update the static route

Dynamic routing

  • A route that a router learns from another router using a routing protocol
  • When the network topology changes, the router updates the routing information

Example of configuring static routes

Note one problem before the configuration: Huawei Ensp is used in this configuration case. When the device is started, an error as shown in the following figure may occur

06

The solution to this problem is to go to routing Device -> right -> Settings

Change the serial port number to 9600, 9601, and 9602, as shown in the following figure

07
Router Configuration

Case description:

As shown in the figure, three routers are connected.

Experimental requirements: Configure the route name, address, and static route to enable PC1 to communicate with PC2.

The port address is shown in the preceding figure.

Note: In the configuration of router R1, network segments 192.168.1.0 and 192.168.2.0 are directly connected to R1 and therefore do not need to be configured in the static routing table. Network segments 192.168.3.0 and 192.168.4.0 are not directly connected to R1 and therefore need to be configured in the static routing table.

The same is true for other router configurations.

Example 1: Configure R1

system-view Enter system mode
undo info-center enable # Close the prompt
interface g0/0/0 Switch to ge0/0/0
IP address 192.168.1.254 24Configure the IP address of ge0/0/0
inter g0/0/1 Switch to ge0/0/1
IP address 192.168.2.1 24Configure the IP address of ge0/0/1 quit # Back to system mode IP route-static 192.168.3.0 24 192.168.2.2Configure a static route IP route-static 192.168.4.0 24 192.168.2.2Configure a static route Copy the code

In the last two lines of commands, which I’m going to do a little bit of explaining here, you’ll see that there are three sets of data:

  • 192.168.3.0/192.168.4.0

    Note The network segment ranges from R1 to 190.168.3.0 /190.168.3.0

  • 24

    This indicates that this is a complete subnet mask and is not divided

  • 192.168.2.2

    Note The next hop of network segments from R1 to 190.168.3.0 /190.168.3.0 is 192.168.2.2, which can also be regarded as the gateway

Example 2: Configure R2

system-view Enter system mode
undo info-center enable # Close the prompt
interface g0/0/0 Switch to ge0/0/0
IP address 192.168.2.2 24Configure the IP address of ge0/0/0
inter g0/0/1 Switch to ge0/0/1
IP address 192.168.3.1 24Configure the IP address of ge0/0/1 quit # Back to system mode IP route-static 192.168.1.0 24 192.168.2.1Configure a static route IP route-static 192.168.4.0 24 192.168.3.2Configure a static route Copy the code

There are two things to note at this point:

1. If R2 wants to travel to network segment 192.168.1.0, the next hop (gateway) is 192.168.2.1.

2. If R2 wants to go to the 192.168.4.0 network segment, the next hop (gateway) is 192.168.3.2.

In R1, the network segment destined for 192.168.3.0 is configured. In R2, do not forget to return to 192.168.1.0.

In the process of routing communication, request packets need to be sent. If the communication is normal, the communication delay information, which is the response information, will be returned. Otherwise, two things may happen:

1. The host address is unreachable. Cause: No IP address is configured

2. The request time out. Cause: Only the route to the destination is configured, but the route back is not configured.

At this point, the IP address from PC1 to 192.168.3.1 can be accessed normally. Now let’s do a simple test. Before the test, you need to configure PC1 first

As shown in the figure below:

08

Note that the gateway address is the same as the IP address of GE0/0/0 of R1. In other words, ge0/0/0 is the gateway of PC1. PC2 is the same!

09

As you can see from the figure above, PC1 has successfully accessed the IP address 192.168.3.1.

Example 3: Configuring R3

system-view Enter system mode
undo info-center enable # Close the prompt
interface g0/0/0 Switch to ge0/0/0
IP address 192.168.3.2 24Configure the IP address of ge0/0/0
inter g0/0/1 Switch to ge0/0/1
IP address 192.168.4.254 24Configure the IP address of ge0/0/1 quit # Back to system mode IP route-static 192.168.1.0 24 192.168.3.1Configure a static route IP route-static 192.168.2.0 24 192.168.3.1Configure a static route Copy the code

The last step is to complete the configuration of PC2. The configuration information of PC2 is shown in the following figure

10

Next, let’s test whether the communication between PC1 and PC2 is realized. The test results are as follows:

11

If no problem occurs, the static route is successfully configured.

Did you learn it?

The last

This is the end of static route configuration. This case is useful is Huawei simulator ENSP, the official website has been removed, if you need to get this tool, open wechat search [children go to school], reply [ENSP] can get.

I see no ending, yet high and low I will search!

I am a reader, a dedicated learner. The more you know, the more you don’t know.

See you next time for more highlights!