Solved [HELP] Public_IP

Hi my friends,

I'm trying to run an app on my FreeBSD 10.1 and I'm still having problem with the connection.

Description of Problem:
image.png


I can not set my public ip to my external ip
image.png


---------------------------

What I discovered?
When I'm connected in my local network, I can run application.
When I'm using a external connection, the client of apllication tries to connected on IP of LAN connection (192.168.1.35) ( netstat).

What I've tried?
- I tried to use bind_ip in config files of my application, but I receive this error (socket_tcp_bind: tcp_socket: Can't assign the requested address
image.png

- Also I tried, to add a line in /etc/hosts (192.168.1.35 app appagassi.ddns.net #App ip
image.png


- Anyway, I've tried to make other configs, but I'm still having problems..


? Attached: Config file example
 

Attachments

It needs /etc/resolv.conf with the relevant information of your gateway. At minimum it needs
Code:
search
nameserver
search would have in your case ddns.net and nameserver would have the gateway's numerical ip.
192.168.1.35 app appagassi.ddns.net

Once resolv.conf is set up, hosts should be put back to its old state to prevent conflicts between the two files.

It could also be your firewall. Did you set up the internet settings in rc.conf, because the output from ifconfig appears incomplete, either you didn't show it, or it's not set up.
 
It needs /etc/resolv.conf with the relevant information of your gateway. At minimum it needs
Code:
search
nameserver
search would have in your case ddns.net and nameserver would have the gateway's numerical ip.


Once resolv.conf is set up, hosts should be put back to its old state to prevent conflicts between the two files.

It could also be your firewall. Did you set up the internet settings in rc.conf, because the output from ifconfig appears incomplete, either you didn't show it, or it's not set up.

Okay, I'm reset /etc/hosts and followed your steps.
  • I'm edited /etc/resolv.conf,

image.png


  • But when I reboot FreeBSD, the file turn back to old config
image.png


image.png
 
If you use DHCP the /etc/resolv.conf will be overwritten. You can prevent this by creating a /etc/dhclient-enter-hooks:
Code:
add_new_resolv_conf() {
	return 0
}
 
If you use DHCP the /etc/resolv.conf will be overwritten. You can prevent this by creating a /etc/dhclient-enter-hooks:
Code:
add_new_resolv_conf() {
    return 0
}

Thanks, that works.

But, 'public_ip' continues on 192.168.1.35
And external connection attempts to connect to it
 
Your machine is probably sitting behind a router that NATs the traffic. In order for the machine to be accessible from the Internet you'll need to redirect a port on that router. The 192.168.0.0/16 address is an RFC-1918 address and is not routed on the Internet. These addresses are specifically meant to be used on private networks.
 
Your machine is probably sitting behind a router that NATs the traffic. In order for the machine to be accessible from the Internet you'll need to redirect a port on that router. The 192.168.0.0/16 address is an RFC-1918 address and is not routed on the Internet. These addresses are specifically meant to be used on private networks.

Thats the point, my machine has a true internet connection, just the app can't get ip


My freebsd is Host DMZ and all ports are open to him.

I Can access FTP&HTTP and other ports, the only problem is

image.png


And, when i use bind_ip: 'IP.OF.MY.NETWORK'
image.png
 
Thats the point, my machine has a true internet connection, just the app can't get ip
No, your machine has a private IP address, it does not have a valid internet IP address.


My FreeBSD is Host DMZ and all ports are open to him.
So you are behind a router that does NAT.

Find your external IP address and connect to that.
 
No, your machine has a private IP address, it does not have a valid internet IP address.



So you are behind a router that does NAT.

Find your external IP address and connect to that.

SirDice, iI'm tried to do this too and still appears this problem
image.png


Is hard to me be more specific, I don’t speak English very well
 
Don't bind the service to the external IP address. You can only bind services to IP addresses that are actually assigned to the machine.

If you must bind it to an IP address bind to the IP address of the machine. Most of the time this isn't needed as services tend to listen on all available IP addresses. It's your router that will take care of translating the external internet IP address to the internal IP address of the host (this is what the "DMZ Host" setting does in your router).
 
Back
Top