Regarding IP behind a LAN, network programming.

IP Address Questions and AnswersCategory: IP QuestionsRegarding IP behind a LAN, network programming.
DarioSamo asked 3 years ago

Hello folks, I'm just learning ATM some networking programming using eNet, a pretty low-level library but with a good performance using UDP packets.

I've been lucky in creating local servers, but my problem comes when it's hosting an internet one.

eNet can normally auto-detect the default IP, or you can just specify it. It works fine if there's no router and the connection is directly between the modem and the computer... but I've got another situation.

My current computer, the one with which I want to host a simple test, is behind a LAN. The modem goes to the first computer, which then shares via the LAN the internet to my comp. If I try to tell eNet to create the server on my Internet's IP(via, it fails. It succeeds if I use the LAN IP, or even a VPN's IP.

So what I'm guessing is, is it probable that these connection attempts are being directed first to the first computer, and not being redirected to mine? Hence why it fails? Is there no way to use as a host the internet's IP if I'm behind the LAN?

BTW, this, apart from solving this particular problem, would solve a lot of other similar situations, like with Source Engine games(GMod, Left 4 Dead) or the like.

1 Answers
Rob Vargas Staff answered 3 years ago

Yes, this can be done. But remember, that one device on the "edge" of your network isn't called a gateway for nothing.

You can do that, but you need port forwarding in effect. Inbound requests need to know which "inside" machine is expecting to receive them.

Know the answer? Login or sign up for an account to answer this question.
Sign Up