Configuring Linux Gateways in Production Networks

Some IT networks may be isolated from public services like DNS and NTP, which causes a standard Linux system not to work out of the box.

This guide covers some of the basic network configuration parameters that may cause a Linux system not to work in a production environment due to the isolated infrastructure. Mind that Linux distributions may use different services for the following topics. Therefore, you may not be able to run some of the commands listed below. This section has been written using a Raspberry Pi with native Debian 12 (bookworm) OS version as example.

Before your support call with the SDA Team, ensure you have SSH access to the Linux device from your computer for screen sharing during the session.

The following is a list of common areas that may prevent connection.

DNS Servers

A Domain Name System (DNS) server resolves domain names to IP addresses to facilitate communication over the internet. Proper DNS configuration is critical for a Linux system operating in a networked environment. Troubleshooting DNS issues involves checking the reachability of the DNS server using commands like ping or nslookup. Ensure that the server is responsive and correctly resolving domain names to IP addresses. Misconfigurations may lead to failure in domain resolution, affecting network communications and internet access.

Testing

Check the DNS server IPs configured on the host with:

cat /etc/resolv.conf

Each DNS server can be tested individually with either nslookup or dig. For example, if the server is 8.8.8.8:

nslookup api.eu1.sdaconsole.io 8.8.8.8
dig @8.8.8.8 api.eu1.sdaconsole.io +short

If these commands are not present, they can either be installed with the dnsutils or with the bind9-dnsutils packages in Debian, or a native command like ping or getent may be used to test the current DNS configuration:

ping api.eu1.sdaconsole.io
getent hosts api.eu1.sdaconsole.io

Configuring

The DNS servers may be managed by different services, depending on the Linux installation. For a Raspberry Pi, it is typically managed by the NetworkManager service. The service that is managing the DNS resolution will likely leave a comment in /etc/resolv.conf telling that it generated the file, such as:

To set the global DNS servers, create the file:

And add:

Restart the NetworkManager service and check the new values in /etc/resolv.conf

NTP Servers

An Network Time Protocol (NTP) server is used in Linux systems to synchronize the system clock with a time source, such as an atomic clock or a central server. Accurate timekeeping is crucial for logging, security protocols, and coordinating actions across a network. The wrong setup of an NTP server will cause HTTPS calls to fail due to SSL certificate invalidation.

Testing

Review the NTP synchronization status, and if the current date and time are correct.

Testing the connection to a specific server:

Configuring

The NTP server may be configured with a domain name, such as 0.debian.pool.ntp.org or ntp.myorg.com, or directly with an IP address.

Add the custom NTP server in the [Time] block, and make sure the line is not commented. Remove any server in FallbackNTP that cannot be reached.

Restart, and make sure to enable the timesync service.

Proxy Servers

A proxy server acts as an intermediary between a client and destination servers, forwarding requests and responses. In enterprise environments, proxy servers are commonly used for security control, content filtering, bandwidth management, and logging of outbound traffic. Linux systems in such networks must be configured to route their HTTP/HTTPS requests through the corporate proxy to access external resources, including package repositories and web services.

Testing

Check if proxy is currently configured by checking the environment variables and system-wide proxy settings:

To check wether a proxy server is needed, attempt to connect directly to an external server:

If it fails with connection errors, proxy may be required. Common errors are, for example, Failed to connect or Connection timed out.

To test a request with a specific proxy server:

Configuring

A proxy address has one of the formats:

Configure proxy for all users and applications:

Add or modify the following lines:

Apply the changes:

To check wether traffic is actually going through the proxy:

Debian Repositories

Debian repositories are servers that host software packages and updates for Debian-based systems. In isolated enterprise environments, access to public Debian mirrors (like deb.debian.org or archive.ubuntu.com) may be blocked for security reasons. Companies often maintain their own internal mirrors to control which packages are available and to reduce external bandwidth usage.

Testing

Check the currently configured repositories:

Here is a comprehensive bash script to completely test the connectivity to the configured repositories:

Another method it to attempt to update package lists to identify repository issues:

Common error messages indicating blocked repositories:

  • Failed to fetch http://deb.debian.org/...

  • Could not resolve 'deb.debian.org'

  • Connection timed out

  • Unable to connect to...

Test a specific repository server manually:

Configuring

Edit the main sources file:

Replace the content with your internal mirror. For Debian 12 (bookworm):

If your internal mirror uses HTTPS:

Note: For HTTPS repositories, ensure the apt-transport-https and ca-certificates packages are installed.

Configure Repository Priority (Optional)

If you need to use both internal and external repositories with preference given to internal:

Add:

This gives internal mirrors higher priority.

Configuring Proxy for Repositories (Optional)

If your network requires a proxy to reach repositories:

Update and Verify

After configuring the repositories:

Common Issues

Issue: apt update hangs indefinitely

Issue: Packages not found after configuring mirror

Issue: Mixed repository sources causing conflicts

Last updated