Default Gateway: What it is and How to set it up

1065

The default gateway often coincides with the router used as an intermediary between the local and the Internet.

In telecommunications networks, the default gateway is a router or other device with data packet routing capabilities that connect the LAN with the Internet. The default gateway setting ( default gateway in English) allows devices connected in the local network to know which system to direct connection requests to hosts reachable through public IP addresses.

Therefore, the default gateway is a sort of intermediary between the local network and the Internet, even if many companies use different ones to convey part of the data traffic to local or remote systems.

When you also configure a regular router, that device has a DHCP server (Dynamic Host Configuration Protocol ), enabled by default, which transmits the correct network configuration to all client devices that request it. Regardless of whether a system connects to the router via Ethernet cable or via WiFi connection, the information transmitted via DHCP includes a local IP address (among those not previously assigned), the subnet mask, the DNS servers to use, and, in fact, the default gateway.

We have already talked about the subnet mask ( Subnet mask, what it is and what it is used for ), explaining that it allows you to establish the range of addresses used in the local network as we have seen the usefulness of DNS servers (see Google DNS, here’s how they work and why they are useful).

The default gateway usually matches the router’s private IP and can be detected in Windows by typing the following command :

ipconfig / all | findstr / c: “Default Gateway”

Default gateway: What it is and How to set it up

If you are using multiple network cards, even virtual ones, you could read different Default Gateway entries. To find out what the default gateway is for each network interface, you can type ipconfig / all and read the adapter’s name that appears above each Default Gateway occurrence.

Alternatively, to find out the default gateways in use on the Windows device, you can type route print at the command prompt.
Default gateway - What it is and How to set it up

By observing what is reported in the column Default gateway, it can usually be verified that the router’s address and IP are identical.

The On-link indications point out that there is a direct connection for the specific route and that it is unnecessary to use a default gateway.

Using the ping command followed by the Default Gateway’s IP address, the latter must necessarily respond. Otherwise, you will not be able to exchange data on the Internet. In case of problems, regardless of the network connection used, it is always good to check the default gateway’s full reachability and functionality.

For the benefit of more experienced readers and technicians, remember that it is possible to add customized routes on the local system with the route add command.

For example, with route add 8.8.8.8 mask 255.255.255.255 192.168.1.254 -p all connection requests directed to the IP 8.8.8.8 (in this case, it is the IP of one of the Google DNS servers) will pass through the Local IP 192.168.1.254.

Using the tracert 8.8.8.8 command, you can check the set route’s operation (the first hop, in this case, will be 192.168.1.254 instead of 192.168.1.1).

To check if the default gateway was manually set in Windows, you can press the key combination Windows + R, type ncpa.cpl, right-click on the card connected to the router (Ethernet or WiFi), select Properties then Internet Protocol version 4, and click on the Properties button.

Default gateway, What it is and How to set it up

Keep in mind that with some telecom operators moving towards IPv6, it may make sense to start configuring networks in ” all-IPv6 ” mode.

You will then need to check the default gateway setting in the Internet Protocol version 6 section. See also IPv6, What it is and why it is important from an Internet of Things perspective.

To read the default gateway on macOS and Linux, just type netstat -nr in the terminal window and read what is reported under the Gateway column.

The What’s my router IP service is useful, which in correspondence with ” Your router’s local/private IP is ” shows the private IP of the router in use (it works with a limited number of devices).