0

I have two linux systems, server and client, whose both ethernet port has VLAN tagging(preconfigured IP address and same subnet), and connected with a common ethernet cable (no router or network switch in between them).

I need to establish communication between the two systems. On the server, I need to develop a program which runs in while(1) and listens to the VLAN port and responds to client request. On the client I need to use normal TCP socket programming in python/C++, which basically binds to its own VLAN IP and connects to server VLAN IP and sends requests.

I tried using scapy to send Ether() packets over the Vlan's and I was able to observe traffic on wireshark, but when I used client request, the server is not accepting the connection.

Can the above problem statement be possible to implement?

For now my question is, can we establish a connection between two vlan ports with just an ethernet cable?

3
  • Unfortunately, questions about programming are off-topic here. Also, remember that recommendations are off-topic on almost all SE sites (I removed the off-topic request for recommendations).
    – Ron Maupin
    Jan 22 at 16:37
  • Shouldn't be a problem with static addressing. It's rather unlikely that you require VLANs but if you use them, both NICs need to fully support 802.1q tagging. However, host configurations/issues and programming are explicitly off-topic here, see the help center. You might want to try on Super User.
    – Zac67
    Jan 22 at 16:48
  • What do you mean by "vlan ports"? Different untagged VLANs are effectively different switches, so they won't be able to talk without a router between those VLANs. If you're asking can you communicate directly over layer-2, of course you can (that's how every layer-3 works over ethernet), but if you aren't using an established layer-3 (IP), you're inventing your own.
    – Ricky
    Jan 22 at 21:38

1 Answer 1

1

You are asking about establishing a trunk between two hosts (host/server configuration questions are off-topic here). The answer is that you can connect two device with a trunk link, as long as both devices are using the same VLANs on the trunk.

Normally, hosts are not configured to understand trunks or tagged frames. If you configure them that way, then you can communicate on the various VLANs on the trunk link, but they must use the same VLANs on each side of the trunk link.

Trunks are normally used between network devices (switches and routers), but sometimes servers will use trunks to connect to multiple VLANs on the same physical interface by configuring a logical interface for each VLAN. That is useful when connecting a server to a switch that has multiple VLANs.

In general is it pointless to connect two hosts using a trunk because you only need a single link between the two hosts. Having multiple VLANs between the hosts really gains nothing, and adding tags to the frames only increases the ethernet overhead to no purpose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.