Jump to content

Recommended Posts

Posted

Hey guys,

 

I'm busy setting up an Asterisk server and I've hit a slight hitch.

 

The setup requires that I have 2 network cards in the machine, one for the internal network and one for the SIP account.

 

Eth0:

IP Address: 192.168.3.100

Subnet Mask: 255.255.224.0

Gateway IP: 192.168.0.25 <- Internet Access

 

Eth1:

IP Address: 10.12.4.108

Subnet Mask: 255.255.255.248

Gateway IP: 10.12.4.105

And then under the SIP Peer details I set: host=10.8.0.5

 

Now I have to set the Gateway on Eth1 to 10.12.4.105 so that the SIP account can talk to 10.8.0.5 but then I do not have internet access on the Asterisk server because I have to clear the Gateway on Eth0.

 

Does anybody have any suggestions?

Posted
You should only ever have one default gateway as that is the address for the upstream router for Internet access. The default gateway, to my knowledge, is only used for Internet access. Remove the default gateway from Eth1. What it looks like you need to do is add some routing rules (sorry can't remember the syntax) to the Asterisk server. Letting the server know that there is a route to 10.8.x.x through 10.12.4.105. I think it should then work.
  • 2 weeks later...
Posted

Hello,

 

You probably want to set up some static routes on eth1 to reach your internal subnet(s).

 

Leave eth0 alone, default route to the internet is fine if that's what you need.

 

So you want eth1 to reach 10.8.0.5 via the internal gateway 10.12.4.105 right?

 

If you only need to reach 10.8.0.5 specifically you could try:

 

route add 10.8.0.5/32 gw 10.12.4.105 dev eth1

 

(if you need to see more than just 10.8.0.5 then you would put in the subnet scope)

 

If this completely breaks things just reboot the box as the route isn't persistent across reboots yet.

  • Thanks 1
Posted (edited)

I use Centos at work, but I'm at home on Ubuntu, so this is from memory, so apologies for any errors. The networking in redhat/debian is quite different.

 

"route add" is temporary (I think), so you'll need to edit the routing scripts.

In Centos, the routing is done through script files in /etc/sysconfig/network-scripts/route-ethX where X is your card.

 

So, to build on tcmd35's suggestion, add this line to the file /etc/sysconfig/network-scripts/route-eth1

10.8.0.0/16 via 10.12.4.105

 

If you only have one address to worry about, you can specify a single address to be routed like this:

10.8.0.5/32 via 10.12.4.105

 

It's possible to specify routing on the more traditional address/netmask/gateway format (using three lines per entry), but the 'via' with bitmask is neater.

 

Here's a great little cheatsheet for netmask/bitmask conversions which everyone should bookmark. It also shows the binary masks so you get a good idea of how the address is split by the mask.

http://www.pawprint.net/designresources/netmask-converter.php

 

Restart your networking with the command: service network restart

 

Another possible gotcha, check the file /etc/sysconfig/network. This can have an entry called GATEWAY which (can) define the default gateway. However, routing in the roue-ethX script files will override any settings here. It can be confusing and it's one to watch.

Edited by jinnantonnixx
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...