NAT Network and RHEL 7 network setup

Discussions about using Linux guests in VirtualBox.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: NAT Network and RHEL 7 network setup

Post by fth0 »

socratis wrote:Networking question for you: assume that I have two VMs, or even better Computers with public IP addresses (like 198.168.4.x), but in a LAN-like environment, and let's go with the simplest case; Ethernet cable to the router. Wouldn't the fact that they're in the same masked range (255.255.255.0) mean that the packets wouldn't go through the router to the outside world, but the router (knowing the arp table) simply forward the packets to the corresponding destination?
Yes, the packets wouldn't go to the outside world. But even your simple scenario may be a little bit more complex as you think by now:

1. If a router device has multiple Ethernet ports, in reality it consists of an integrated Ethernet switch and a router, and the router is internally connected to an invisible switch port. In consequence, the router doesn't automatically 'see' all traffic going through the internal switch (like in the case with an external switch device). However, the router has access to the ARP cache of the switch.

2. In the simplest case, the router will only see the ARP requests (Ethernet broadcast frames), but neither the local ARP replies (Ethernet unicast frames) nor the IPv4 packets. The router itself will not even answer the ARP requests, despite knowing the answer. (Unless configured for Proxy ARP, which is normally used for more complex scenarios like road warriors.)

In the NAT networking case however, the router usually has no knowledge of the IPv4 addresses of the NAT network. If an IPv4 packet reaches the router (because of it's gateway functionality), then the IPv4 destination address is searched for in the routing table, which usually contains (amongst others) the configured local networks, the blocking routes for the private IPv4 address ranges, and a default route to the Internet ...
EddyR
Posts: 16
Joined: 23. Jul 2019, 09:49

Re: NAT Network and RHEL 7 network setup

Post by EddyR »

All.
Sorry for the delay as I was taken off onto different projects.
All the comments re OCR, etc., are correct so I went back and formalized the question (screenshots are available).

Issue: I'm using Oracle VirtualBox on Windows 10 with the default installation. When I create a brand new Linux VM (CentOS/Red Hat) using the NAT Network that I have defined which provides DHCP service, I receive a default IP address in a different subnet. I expected to get an IP address in the subnet that I defined in the NatNetwork CIDR.

Specifics:
• NatNetwork defined with CIDR 192.168.4.0/24
• CentOS – as an example – defined to use DHCP
• After new install I expect to get an IP address from DHCP in the subnet 192.168.0 but in fact I get an IP in 198.168.4.0
NOTE that the default GW is defined correctly (192.168.4.1)

• If I setup the IP interface correctly then I can automatically ping the gateway and the outside world as expected, as well as other VMs in that subnet (which is the definition of the NAT Network)

To get rid of the 198.168.4.0 address I need to edit /etc/sysconfig/network-scripts/ifcfg-eth0 and change BOOTPROTO=none followed by
# nmcli connection up eth0

Environment details:
Oracle VirtualBox: Version 6.0.10 r132072 (Qt5.6.2)
Windows 10 Enterprise
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: NAT Network and RHEL 7 network setup

Post by socratis »

EddyR wrote:NatNetwork defined with CIDR 192.168.4.0/24 ... I expect to get an IP address from DHCP in the subnet 192.168.0
Why would you expect that? If you have defined a specific IP range for you DHCP server, expect an IP from that range. Not a random thing...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: NAT Network and RHEL 7 network setup

Post by fth0 »

Additional questions: What is the network configuration of the host? Can you provide us with the output of 'ipconfig /all' and 'route print' from the host?
EddyR
Posts: 16
Joined: 23. Jul 2019, 09:49

Re: NAT Network and RHEL 7 network setup

Post by EddyR »

Another typo of mine - of course I'd expect an IP in the range of 192.168.4 but I get one in the range of 198.162.4
Have you tried this on your installation and get the correct IP from DHCP?

Re output from the host:

Code: Select all

T:\>ipconfig

Windows IP Configuration


Ethernet adapter Local Area Connection* 3:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter Ethernet:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : Home

Ethernet adapter vEthernet (Default Switch):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::d9c1:14e1:9784:b03b%3
   IPv4 Address. . . . . . . . . . . : 172.21.52.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.240
   Default Gateway . . . . . . . . . :

Ethernet adapter vEthernet (DockerNAT):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::502:8751:d6bd:d05b%26
   IPv4 Address. . . . . . . . . . . : 10.0.75.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::4875:67df:74bb:b43f%8
   IPv4 Address. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Ethernet adapter Ethernet 4:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 1:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter Ethernet 2:

   Connection-specific DNS Suffix  . : bynet.co.il
   Link-local IPv6 Address . . . . . : fe80::b4b9:2d35:372f:c8b0%20
   IPv4 Address. . . . . . . . . . . : 10.101.0.141
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . : 10.101.254.254

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wi-Fi:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : Home

PPP adapter Umbrella:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 100.122.139.216
   Subnet Mask . . . . . . . . . . . : 255.255.255.255
   Default Gateway . . . . . . . . . :

T:\>route print
===========================================================================
Interface List
  9...00 ff b0 8b 52 6d ......Juniper Network Connect Virtual Adapter
 21...e4 b9 7a 40 21 19 ......Intel(R) Ethernet Connection (4) I219-LM
  3...c2 15 e6 46 8a 4c ......Hyper-V Virtual Ethernet Adapter
 26...00 15 5d 81 1b 04 ......Hyper-V Virtual Ethernet Adapter #2
  8...0a 00 27 00 00 08 ......VirtualBox Host-Only Ethernet Adapter
  5...54 61 be 0d 97 18 ......Check Point Virtual Network Adapter For Endpoint VPN Client
 18...64 5d 86 c6 8f d2 ......Microsoft Wi-Fi Direct Virtual Adapter
 23...66 5d 86 c6 8f d1 ......Microsoft Wi-Fi Direct Virtual Adapter #2
 20...e4 b9 7a c2 65 ea ......Realtek USB GbE Family Controller
 16...64 5d 86 c6 8f d5 ......Bluetooth Device (Personal Area Network)
 12...64 5d 86 c6 8f d1 ......Intel(R) Dual Band Wireless-AC 8265
  1...........................Software Loopback Interface 1
101...........................Umbrella
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0   10.101.254.254     10.101.0.141     35
       2.17.34.39  255.255.255.255         On-link   100.122.139.216    600
     2.17.102.118  255.255.255.255         On-link   100.122.139.216    600
      5.62.48.218  255.255.255.255         On-link   100.122.139.216    600
        10.0.75.0    255.255.255.0         On-link         10.0.75.1    271
        10.0.75.1  255.255.255.255         On-link         10.0.75.1    271
      10.0.75.255  255.255.255.255         On-link         10.0.75.1    271
       10.101.0.0      255.255.0.0         On-link      10.101.0.141    291
     10.101.0.141  255.255.255.255         On-link      10.101.0.141    291
   10.101.255.255  255.255.255.255         On-link      10.101.0.141    291
   14.215.158.100  255.255.255.255         On-link   100.122.139.216    600
       23.4.43.27  255.255.255.255         On-link   100.122.139.216    600
     23.41.177.70  255.255.255.255         On-link   100.122.139.216    600
   23.108.191.211  255.255.255.255         On-link   100.122.139.216    600
    23.212.54.230  255.255.255.255         On-link   100.122.139.216    600
     37.220.39.62  255.255.255.255         On-link   100.122.139.216    600
   37.252.232.102  255.255.255.255         On-link   100.122.139.216    600
   61.151.165.101  255.255.255.255         On-link   100.122.139.216    600
   61.151.165.102  255.255.255.255         On-link   100.122.139.216    600
       62.8.79.10  255.255.255.255         On-link   100.122.139.216    600
   62.138.209.134  255.255.255.255         On-link   100.122.139.216    600
   62.138.209.148  255.255.255.255         On-link   100.122.139.216    600
   62.138.209.160  255.255.255.255         On-link   100.122.139.216    600
   62.138.209.164  255.255.255.255         On-link   100.122.139.216    600
   62.138.209.170  255.255.255.255         On-link   100.122.139.216    600
    67.215.68.253  255.255.255.255         On-link   100.122.139.216    600
     67.215.70.91  255.255.255.255         On-link   100.122.139.216    600
   67.227.226.240  255.255.255.255         On-link   100.122.139.216    600
    69.22.151.220  255.255.255.255         On-link   100.122.139.216    600
    69.22.151.221  255.255.255.255         On-link   100.122.139.216    600
     69.192.2.132  255.255.255.255         On-link   100.122.139.216    600
     69.192.2.137  255.255.255.255         On-link   100.122.139.216    600
    72.52.179.175  255.255.255.255         On-link   100.122.139.216    600
    74.125.68.138  255.255.255.255         On-link   100.122.139.216    600
   80.231.123.131  255.255.255.255         On-link   100.122.139.216    600
    92.123.65.126  255.255.255.255         On-link   100.122.139.216    600
     92.242.140.2  255.255.255.255         On-link   100.122.139.216    600
     94.136.40.51  255.255.255.255         On-link   100.122.139.216    600
     95.101.30.97  255.255.255.255         On-link   100.122.139.216    600
  100.122.139.216  255.255.255.255         On-link   100.122.139.216    756
    101.89.15.100  255.255.255.255         On-link   100.122.139.216    600
   101.226.49.141  255.255.255.255         On-link   100.122.139.216    600
   101.226.49.144  255.255.255.255         On-link   100.122.139.216    600
   113.96.209.108  255.255.255.255         On-link   100.122.139.216    600
    113.219.145.1  255.255.255.255         On-link   100.122.139.216    600
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    331
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    331
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    331
    134.170.3.182  255.255.255.255         On-link   100.122.139.216    600
    146.112.62.40  255.255.255.255         On-link   100.122.139.216    600
     149.36.228.3  255.255.255.255         On-link   100.122.139.216    600
     149.36.228.6  255.255.255.255         On-link   100.122.139.216    600
    154.73.75.130  255.255.255.255         On-link   100.122.139.216    600
    154.73.75.132  255.255.255.255         On-link   100.122.139.216    600
  157.185.169.223  255.255.255.255         On-link   100.122.139.216    600
  157.185.177.206  255.255.255.255         On-link   100.122.139.216    600
    157.240.16.35  255.255.255.255         On-link   100.122.139.216    600
      172.21.52.0  255.255.255.240         On-link       172.21.52.1    271
      172.21.52.1  255.255.255.255         On-link       172.21.52.1    271
     172.21.52.15  255.255.255.255         On-link       172.21.52.1    271
   172.217.21.162  255.255.255.255         On-link   100.122.139.216    600
  172.217.194.147  255.255.255.255         On-link   100.122.139.216    600
  178.132.201.156  255.255.255.255         On-link   100.122.139.216    600
  178.255.155.178  255.255.255.255         On-link   100.122.139.216    600
    179.185.45.21  255.255.255.255         On-link   100.122.139.216    600
     183.3.234.11  255.255.255.255         On-link   100.122.139.216    600
  183.192.169.103  255.255.255.255         On-link   100.122.139.216    600
   183.236.60.129  255.255.255.255         On-link   100.122.139.216    600
  188.172.192.101  255.255.255.255         On-link   100.122.139.216    600
  188.172.198.140  255.255.255.255         On-link   100.122.139.216    600
   192.30.253.112  255.255.255.255         On-link   100.122.139.216    600
     192.168.56.0    255.255.255.0         On-link      192.168.56.1    281
     192.168.56.1  255.255.255.255         On-link      192.168.56.1    281
   192.168.56.255  255.255.255.255         On-link      192.168.56.1    281
   195.244.97.198  255.255.255.255         On-link   100.122.139.216    600
   195.244.97.214  255.255.255.255         On-link   100.122.139.216    600
   195.244.97.218  255.255.255.255         On-link   100.122.139.216    600
   195.244.97.222  255.255.255.255         On-link   100.122.139.216    600
   195.244.97.228  255.255.255.255         On-link   100.122.139.216    600
   195.244.97.230  255.255.255.255         On-link   100.122.139.216    600
   195.244.97.234  255.255.255.255         On-link   100.122.139.216    600
   199.59.242.151  255.255.255.255         On-link   100.122.139.216    600
   203.205.146.17  255.255.255.255         On-link   100.122.139.216    600
  203.205.151.204  255.255.255.255         On-link   100.122.139.216    600
   203.205.158.67  255.255.255.255         On-link   100.122.139.216    600
  203.205.219.196  255.255.255.255         On-link   100.122.139.216    600
  203.205.255.143  255.255.255.255         On-link   100.122.139.216    600
     208.69.35.24  255.255.255.255   10.101.254.254     10.101.0.141     36
   208.87.239.202  255.255.255.255         On-link   100.122.139.216    600
  209.107.220.190  255.255.255.255         On-link   100.122.139.216    600
   209.170.97.239  255.255.255.255         On-link   100.122.139.216    600
   213.131.255.22  255.255.255.255         On-link   100.122.139.216    600
   213.131.255.24  255.255.255.255         On-link   100.122.139.216    600
   213.131.255.28  255.255.255.255         On-link   100.122.139.216    600
    213.186.33.17  255.255.255.255         On-link   100.122.139.216    600
  213.227.185.136  255.255.255.255         On-link   100.122.139.216    600
   222.165.175.38  255.255.255.255         On-link   100.122.139.216    600
  222.165.175.166  255.255.255.255         On-link   100.122.139.216    600
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    331
        224.0.0.0        240.0.0.0         On-link      192.168.56.1    281
        224.0.0.0        240.0.0.0         On-link         10.0.75.1    271
        224.0.0.0        240.0.0.0         On-link       172.21.52.1    271
        224.0.0.0        240.0.0.0         On-link      10.101.0.141    291
        224.0.0.0        240.0.0.0         On-link   100.122.139.216    756
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    331
  255.255.255.255  255.255.255.255         On-link      192.168.56.1    281
  255.255.255.255  255.255.255.255         On-link         10.0.75.1    271
  255.255.255.255  255.255.255.255         On-link       172.21.52.1    271
  255.255.255.255  255.255.255.255         On-link      10.101.0.141    291
  255.255.255.255  255.255.255.255         On-link   100.122.139.216    756
===========================================================================
Persistent Routes:
  None

IPv6 Route Table
===========================================================================
Active Routes:
 If Metric Network Destination      Gateway
  1    331 ::1/128                  On-link
  8    281 fe80::/64                On-link
 26    271 fe80::/64                On-link
  3    271 fe80::/64                On-link
 20    291 fe80::/64                On-link
 26    271 fe80::502:8751:d6bd:d05b/128
                                    On-link
  8    281 fe80::4875:67df:74bb:b43f/128
                                    On-link
 20    291 fe80::b4b9:2d35:372f:c8b0/128
                                    On-link
  3    271 fe80::d9c1:14e1:9784:b03b/128
                                    On-link
  1    331 ff00::/8                 On-link
  8    281 ff00::/8                 On-link
 26    271 ff00::/8                 On-link
  3    271 ff00::/8                 On-link
 20    291 ff00::/8                 On-link
===========================================================================
Persistent Routes:
  None
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: NAT Network and RHEL 7 network setup

Post by fth0 »

EddyR wrote:Re output from the host: [...]
A lot of different networks. But I see nothing that should interfere with your NAT network.
EddyR wrote:Another typo of mine - of course I'd expect an IP in the range of 192.168.4 but I get one in the range of 198.162.4
Yet another typo of yours (the part I underlined)? As long as you intermix 192, 198, 168 and 162, which of your given information am I supposed to believe and which not?

If I were you, I would only use private IP address ranges in local networks (like the NAT network). From those 4 numbers, only the 192.168.x.y combination would qualify.
EddyR
Posts: 16
Joined: 23. Jul 2019, 09:49

Re: NAT Network and RHEL 7 network setup

Post by EddyR »

You're right again - my typo.
My CIDR is 192.162.4.0/24
The VM get 198.162.4.x from the VB's DHCP server - this is incorrect and not as documented.

Do you experience something different in your own setup?
If not, why is my VB acting in this fashion?
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: NAT Network and RHEL 7 network setup

Post by socratis »

EddyR wrote:Do you experience something different in your own setup?
Yes, everything is working fine on 99.99% of the cases. You're the 0.01%.
EddyR wrote:If not, why is my VB acting in this fashion?
No clue if it's in reality VirtualBox at this point...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
EddyR
Posts: 16
Joined: 23. Jul 2019, 09:49

Re: NAT Network and RHEL 7 network setup

Post by EddyR »

Why wouldn't this work for all cases?
What would make this not work?
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: NAT Network and RHEL 7 network setup

Post by socratis »

EddyR wrote:Why wouldn't this work for all cases?
Because it depends on the guest configuration, and you might have done something in there. What exactly? I don't have the slightest idea. But most certainly this doesn't look like a VirtualBox issue.
EddyR wrote:What would make this not work?
Start from scratch. Or figure out what's going on with your guest. We can't do that from here...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply