0

I'm trying to create a nat, however, before I can get that far I need to network two PCs via ethernet.

The server looks like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:e0:4c:68:31:a8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.3.0/24 brd 192.168.3.255 scope global enp2s0
       valid_lft forever preferred_lft forever
    inet6 fe80::2e0:4cff:fe68:31a8/64 scope link 
       valid_lft forever preferred_lft forever
3: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:e0:4c:68:31:a9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.130/24 brd 192.168.1.255 scope global noprefixroute dynamic enp3s0
       valid_lft 86098sec preferred_lft 86098sec
    inet6 fe80::b8df:4b68:a402:677c/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
  • enp3s0 is WAN and works fine from the server and should be on network 192.168.1.*

  • enp2s0 is the LAN connection and should be its own network on 192.168.3.*

My /etc/dhcp/dhcp.conf looks like this:

subnet 192.168.3.0 netmask 255.255.255.0 {
        range 192.168.3.1 192.168.3.254;
}

I have also tried with:

subnet 192.168.3.0 netmask 255.255.255.0 {
        range 192.168.3.1 192.168.3.254;
        option domain-name-servers 8.8.8.8, 8.8.4.4;
        option domain-name "test.local";
        option routers 192.168.3.2;
        option broadcast-address 192.168.3.255;
}

However, I don't think option routers is correct there.

The server is assigned a static IP in /etc/sysconfig/network-scripts/ifcfg-enp2s0

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPADDR=192.168.3.0
NETMASK=255.255.255.0
NM_CONTROLLED=no
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp2s0
UUID=ea3a50d3-562e-4f7d-bd20-70d85bf882d0
DEVICE=enp2s0
ONBOOT=yes

I wasn't sure .0 was correct here, but using anything else the client cannot connect. With the server on 192.168.3.0 the client connects and gets assigned the IP 192.168.3.1 which looks correct.

However, I cannot ping 192.168.3.0 from the client or 192.168.3.1 from the server. They can connect but cannot seem to communicate. Ping eventually gives "Destination host unreachable"

I'm fairly sure the problem is with the server as I can connect the same client to other networks fine. Am I missing a configuration option or have I configured the server incorrectly?

I have set /proc/sys/net/ipv4/ip_forward to 1, though that should not prevent the client pinging the server.

Tom B
  • 175
  • 1
  • 1
  • 6
  • 1
    Valid IP addresses for a `/24` network are `.1-.254`. First and last addresses `.0` and `.255` are reserved. – Thomas Nov 10 '18 at 17:44
  • Aha, thank you. By setting IPADDR=192.168.3.1 and removing options routers from dhcpd.conf I was able to connect and ping. Thanks. – Tom B Nov 10 '18 at 17:51

0 Answers0