L
L
Lev K2017-10-26 21:22:36
ubuntu
Lev K, 2017-10-26 21:22:36

Am I thinking about routing correctly, ubuntu?

Hello.
I deal with routing and I want to understand whether I think correctly?
There are 2 virtual machines (VirtualBox)
1 - server with 2 "networks": NAT & internal network
2 - client: internal network
From the host machine to the server there is traffic on 10.0.2.15 and on the server I set the ip of the second network card in the settings 192.168.

$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:3d:b5:b7  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::90b2:8090:20ea:65e9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:56 errors:0 dropped:0 overruns:0 frame:0
          TX packets:133 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:11885 (11.8 KB)  TX bytes:13152 (13.1 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:e4:b1:0d  
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::54b7:d821:29f8:939b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:386 errors:0 dropped:0 overruns:0 frame:0
          TX packets:280 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:29456 (29.4 KB)  TX bytes:25447 (25.4 KB)

lo        Link encap:Локальная петля (Loopback)  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:208 errors:0 dropped:0 overruns:0 frame:0
          TX packets:208 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:21502 (21.5 KB)  TX bytes:21502 (21.5 KB)

Do I need to connect to server 192.168.0.100 c 10.0.2.15 (or 10.0.2.2?) or something else?
$ netstat -n -r
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 enp0s8
0.0.0.0         10.0.2.2        0.0.0.0         UG        0 0          0 enp0s3
10.0.2.0        0.0.0.0         255.255.255.0   U         0 0          0 enp0s3
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 enp0s8
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 enp0s8
192.168.0.0     10.0.2.15       255.255.255.0   UG        0 0          0 enp0s3 // пробовал и по одному 
192.168.0.0     10.0.2.2        255.255.255.0   UG        0 0          0 enp0s3 // и вместе результат не изменился


But when I ping from the client machine, I get: (here I set ip 192.168.0.200 on the gateway 192.168.
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.0.200 icmp_seq=1 Destination Host Unreachable


The question is, where do you need to direct route on the server machine in order for the network to work on client ?
In theory, there are not many options (as I think):
on 127.0.0.1 (0.0.0.0) - unlikely
on 10.0.2.2, 10.0.2.15 - both options do not work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Griboks, 2017-10-26
@Griboks

I didn’t understand almost anything, but I’ll tell you how I did it myself:
1) I connected something else to two ports of the server and configured iptables for NAT packet relaying.
2) I climbed in the VirtualBox settings and checked the boxes, as written in the manual.
ps
These are two different options I have on two different host machines.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question