Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 05-10-2008, 02:55 PM   #1
LQ Newbie
Registered: May 2008
Posts: 1

Rep: Reputation: 0
[VirtualBox - Internal Networking] Client/Server Problems

Hi all,

first of all, I hope that I posted at the right place.

I am hosting Linux on Linux (Ubuntu on Ubuntu to be precise) in order to test a client/server application. But I've got some problems with internal networking.

The server and the client are separate VM's (not surprising Smile).

The server has 1 active interface of type 'intnet'. I assign a static IP of (Mask :

My client has 2 active interfaces of type 'intnet'. I assign a static IP to both :
1) (Mask :
2) (Mask :

Using Konsole from the server, I can ping client's first interface, and conversely. No communication is possible between the server and client's second interface.

In my C program, my client binds a socket to each of its interfaces then sends a request to the server. Surprisingly the server receives both requests (coming from 2 distinct addresses, C1 et C2). The server sends the response to these requests but C2 doesn't receive anything.

If my server has a second active interface ( Things happens the same way but this time C2 receives the response (even if in my server C program I don't bind any socket to this other interface).

These things seems absolutely weird. Am I crazy ?

I suppose I am making a mistake somewhere. But I can't see if it is in my C program of in my internal network configuration.

What do you think of it ?

Thank you.
Old 05-11-2008, 05:34 PM   #2
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
This problem is a little obscured by the virtualization of it all, but it seems fairly clear to me that, in the first case you describe, the server has no idea how to route a packet to 192.168.2.x, so it should be routed out the default gateway (in the route table, netstat -rn, this appears with the flags UG and a destination of That probably either goes to the Internet (where the Private Network packet will be dropped immediately) or somewhere else that does not get it to your client.

The second scenario does not yield to such a simple analysis, though. How sure are you that the message you received on C2 was actually addressed to Could the server be sending both replies out both interfaces?
Old 05-12-2008, 01:05 AM   #3
Senior Member
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
If I understand you correctly you are running two internal networks with a total of three interfaces, or you may even have all three interfaces running on the same internal network, but the reason you are getting this network connectivity issue I believe is rather simple. You are using class C private IP addresses, and you are assigning the server interface (We'll call
it S1 from now on) and the client interface 1 (We'll call it C1 from now on) on one internal IP network, while the second client interface (C2) is on a different network. If we look at IPv4 addressing we have Class A, B and C, Class A reservers only the fist octet of the IP for the network designation i.e. the 10 designates that this is a private IPv4 Class A network, we can subnet but that is another discussion. For Class B the first two octets designate the network address so for instance we have, then we have Class C which uses 3 octets for the network address, i.e. and so your S1 is on the network as is C1, but C2 is on the network, when you add a second interface to the server and assign it (S2), you place S2 on the same network as C2. This may seem a little confusing but we are mixing physical (in this case virtually physical) internal networking with logical networking the physical network only transports the data to and from based on the physical hardware address of a device (MAC address on network interfaces) where as logical addressing is directed based upon a logically assigned address, IP address in this case. So unless routing is set up using IPtables and/or NAT on your client computer the two distinct networks cannot communicate because the only interface the server is aware of is the one connected to the network so all data out goes to this network, however, there are no interfaces on this network that are listening for data destined for the network, and the server also does not have a specific address on the network that accepts data for the network and forwards it to the right place. However, you might ask "Well data sent out by the interface on the client gets to the server, Why doesn't it get back?" Well the reason the data reaches the server for one of two reasons, though I am not sure which. 1)The routing table on the client computer routes the data for the network out of C1, and when data coming from C2 destined for the server is output the computer routes that data over C1. the other possibility 2)Is that because we are on the same "physical" network when output destined for the server at finds it because there is a device connected to the network with that logical address. I think the first possibility is the more likely of the two. Now you could test this if you set up a third VM that functioned only as a router with two interfaces on this same "physical" network and set one as 192.168.1.x and the other as 192.168.2.x then set it as the default gateway for traffic on the server routing tables, then you network interfaces should work, that is provided I am right about this whole thing. Hopefully I do know what I am talking about having a Bachelors degree in Network Administration, and being a tech geek in general. Good luck let us know what happend no matter what you do.

PS. Adding a second interface on the server connected to would also serve similarly to the third VM as a router, because it would be connected to the same logical network as C2. And any data destined for C2 would be routed over the servers second connection connected to the network.
Old 05-12-2008, 01:13 AM   #4
Senior Member
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
BTW your server would see the data from C2 as coming from a seperate interface because C1 does not NAT the packets coming from C2 that are routed over the C1 interface


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
VirtualBox and networking AQG Linux - Software 2 06-02-2008 12:50 PM
Virtualbox networking madness! ddales Linux - Networking 1 01-28-2008 10:49 PM
Virtualbox Networking problem 00yahoo Ubuntu 1 07-13-2007 07:54 AM
Mandrake 10 (server) to Windows XP (client) networking (how to). bluevd Linux - Networking 1 09-13-2004 02:35 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration