How do switches and routers connect to the Internet? What are the configurations?

Premier Mellanox Selections: best-selling Mellanox Switches, Network Cards, and Cables

Before we published about the Internet connection before the switch and the firewall, friends kept asking about the Internet connection configuration before the switch and the router. This is widely used in actual projects. Basically, some large-scale network projects need to be configured. About The topic of switch and router configuration is also constantly discussed.
In this issue, let’s learn about the configuration of the connection between the switch and the router.

Case: Layer 3 switch and router interconnection configuration
1. Project situation

A company has multiple departments located on different network segments, and each department needs to access the Internet. Users are now required to access the external network through layer-3 switches and routers, and layer-3 switches are required to serve as the user’s gateway. Here we take Huawei switches as an example.

2.configuration ideas

Use the following ideas to configure:
1. Configure the switch as the gateway for users, and realize mutual access between users across network segments through the VLANIF interface.
2. Configure the switch as a DHCP server to assign IP addresses to users.
3. Configure the router to pass NAT conversion, so that users can access the external network.

3. Switch configuration

Configure the switch

# Configure the interface connecting users and the corresponding VLANIF interface.

# Configure the interface connected to the router and the corresponding VLANIF interface.

# Configure DHCP server.

2. Configure the router

# Configure the IP address corresponding to the interface connected to the switch.

# Configure the IP address corresponding to the interface connected to the public network.

# Configure the default route and return route.

# Configure the NAT function so that intranet users can access the external network.

4.Check the configuration results

Set the IP address of PC1 to and the gateway to; the IP address of PC2 to and the gateway to

Configure the IP address of the PC on the external network as and the gateway as

After the configuration is complete, both PC1 and PC2 can ping the IP of the external network, and both PC1 and PC2 can access the Internet.

Add here: What is vlanif? The difference between it and vlan?

Many friends have asked about this vlanif interface many times, here is the addition:

vlanif is used when creating a layer-3 interface. It is a virtual interface and can be configured with an IP address; vlan is a purely layer-2 vlan ID identifier, which is equivalent to labeling data.

After VLANs are divided, users in the same VLAN can communicate with each other, but users in different VLANs cannot communicate directly. In order to realize inter-VLAN communication, it can be realized by configuring a logical Layer 3 interface (VLANIF interface).

When a switch needs to communicate with devices at the network layer, a VLAN-based VLANIF interface can be created on the switch for communication. Therefore, multiple vlanifs are configured in this article, and it is easier to understand if you can imagine vlanif as a port of a router.

Want to streamline your network setup? Explore our expert guide on Router-switch integration for seamless internet connectivity. Enhance your system with top-notch products from Router Switch – your go-to destination for reliable networking solutions. Click now to elevate your integration game!
Check More Router Switch Products:

Cisco Routers

Huawei Switches

Fortinet FortiGate Firewalls

Read More:

Join Router Switch Blog as a Guest Writer and Columnist!

Igniting the Future of ICT: An Invitation to’s InnovateTech Speaker Program

Can Cisco ASA 5505 Firewall be used as a Router?

Share This Post

Post Comment