OpenSIPs stun module require two IP addresses

1.2k views Asked by At

I have to make a STUN server in OpenSIPs, and it says that I need to bind 2 IP addresses. http://www.opensips.org/About/News0042

A STUN server uses 2 ips and 2 ports to create 4 sockets on which to listen or respond.
STUN requires 2 routable ip addresses

How can I enable two public IP addresses into one Linux server? I've searched all website, and failed to find the answer.

1

There are 1 answers

5
selbie On BEST ANSWER

Several options.

Option 1.

You likely just need to use ifconfig from the command line to start

You can assign an additional static IP address to your NIC via the command line. Type ifconfig to get the name of your default adapter. It's typically "eth0". Then do add a secondary address to this adapter, the command is something like the following:

sudo ifconfig eth0:1 inet up netmask 255.255.255.0 192.168.1.55

Where 255.255.255.0 is the netmask of my 8-bit subnet and 192.16.1.55 is an existing IP address that no other device on my subnet is already using.

Option 2.

After you get your server up and running with Option 1, you likely need to find a way to get the IP address assigned by "ifconfig" to persist after a reboot. You could likely stick an ifconfig statement into one of your rc.init files. But most Linux skus have a formal way of configuring an interface with another /etc file. But this step varies between different flavors of Linux. On Ubuntu, this is all defined in the /etc/network/interfaces file. Add these three lines to the bottom of your existing file:

iface eth0:1 inet static
address 192.168.1.55
netmask 255.255.255.0

Option 3 (shameless plug)

Switch to Stuntman ( www.stunprotocol.org ) as your STUN server. Its default mode only requires one IP address to be present on the box. Most client usages of the STUN protocol don't require the second IP address unless to do NAT classification and behavior tests.