1

I have Ubuntu 16.04 and 2 Network Interfaces. Workers can't access this server from internet only accessible LAN. My second network card configure with static ip address. Subdomain redirect to this static ip address. I added an A record for this static IP at my hosting server. DNS server also installed at this server

#

network configuration is

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eno1
iface eno1 inet static
        address 192.168.x.x
        netmask 255.255.255.0
        network 192.168.x.0
        broadcast 192.168.x.255
        gateway 192.168.x.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 192.168.x.1 192.168.x.5
        dns-search domain.org.pk
## Interface configuration for Nexlinx connection
auto eno2
**iface eno2 inet static**
        address 116.x.x.x
        netmask 255.255.255.x
        broadcast 116.x.x.x
        gateway 116.x.x.153
        dns-nameservers 116.x.x.x 202.x.x.x

What setting required to accessible server publicly? When I installed Ubuntu 16 server I set primary address 192.168.x.x. Can I change static ip address secondary to primary? how?

2
  • Please, can you give us output from command route -n
    – 2707974
    Feb 27, 2017 at 7:17
  • @2707974 Kernel IP routing table --- Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 eno1 116.58.137.152 0.0.0.0 255.255.255.248 U 0 0 0 eno2 192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eno1
    – Anees
    Feb 27, 2017 at 8:14

1 Answer 1

1

Based on output of your route -n command, your default gateway is set to 192.186.10.1 aka eno1 interface. Because of that your server in not Public accessible. You can change via changing metric for default routes.

Metric can change on several place. Best working for me is configuration in /etc/network/interfaces

auto lo
iface lo inet loopback
auto eno0
iface eno0 inet static
    address 192.168.x.x
    netmask 255.255.255.0
    network 192.168.x.0
    broadcast 192.168.x.255
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.x.1 192.168.x.5
    dns-search domain.org.pk
    up route add default gw 192.168.x.1 metric 10

auto eno1
iface eno1 inet static
    address 116.x.x.x
    netmask 255.255.255.x
    broadcast 116.x.x.x
    gateway 116.x.x.153
    dns-nameservers 116.x.x.x 202.x.x.x

On this way we add metric 10 to the eno0 interface and on is now second best. Primary route is on eno1. After this changes restart networking.

 systemctl restart networking.service

Now route -n will be different.

NOTE: If you communicate via eno0 only with 192.168.x.x network you do not need gateway on that interface. I mean, you can simple delete gateway from eno0 interface setup.

9
  • not working after suggested changes still not accessible internet
    – Anees
    Mar 10, 2017 at 6:01
  • Please give me output from route -n, before and after changes.
    – 2707974
    Mar 10, 2017 at 7:04
  • Kernel IP routing table roun -n output after your suggested changes....
    – Anees
    Mar 10, 2017 at 9:41
  • Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 eno1 116.58.127.152 0.0.0.0 255.255.255.248 U 0 0 0 eno2 192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eno1
    – Anees
    Mar 10, 2017 at 9:42
  • before changes.....Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 eno1 116.58.137.152 0.0.0.0 255.255.255.248 U 0 0 0 eno2 192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eno1
    – Anees
    Mar 10, 2017 at 9:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .