+ Post New Thread
Results 1 to 7 of 7
*nix Thread, 2 Default Gateways in Technical; Hey guys, I'm busy setting up an Asterisk server and I've hit a slight hitch. The setup requires that I ...
  1. #1
    Nick_Parker's Avatar
    Join Date
    Jan 2008
    Location
    Dainfern, South Africa
    Posts
    435
    Thank Post
    95
    Thanked 18 Times in 13 Posts
    Rep Power
    17

    2 Default Gateways

    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?

  2. #2

    tmcd35's Avatar
    Join Date
    Jul 2005
    Location
    Norfolk
    Posts
    5,575
    Thank Post
    834
    Thanked 873 Times in 726 Posts
    Blog Entries
    9
    Rep Power
    324
    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.

  3. #3
    Nick_Parker's Avatar
    Join Date
    Jan 2008
    Location
    Dainfern, South Africa
    Posts
    435
    Thank Post
    95
    Thanked 18 Times in 13 Posts
    Rep Power
    17
    Thanks @tmcd35 - that sounds like exactly what I need to do!

  4. #4
    Nick_Parker's Avatar
    Join Date
    Jan 2008
    Location
    Dainfern, South Africa
    Posts
    435
    Thank Post
    95
    Thanked 18 Times in 13 Posts
    Rep Power
    17
    So I'm still a bit stuck, could anybody give me a hint?

  5. #5


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,684
    Thank Post
    352
    Thanked 794 Times in 714 Posts
    Rep Power
    346
    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.

  6. Thanks to kmount from:

    Nick_Parker (23rd March 2013)

  7. #6

    jinnantonnixx's Avatar
    Join Date
    Mar 2011
    Location
    In the Calamatorium.
    Posts
    1,936
    Thank Post
    109
    Thanked 471 Times in 324 Posts
    Blog Entries
    2
    Rep Power
    266
    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
    Code:
    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:
    Code:
    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/designresour...-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.
    Last edited by jinnantonnixx; 23rd March 2013 at 09:44 AM.

  8. Thanks to jinnantonnixx from:

    Nick_Parker (23rd March 2013)

  9. #7
    Nick_Parker's Avatar
    Join Date
    Jan 2008
    Location
    Dainfern, South Africa
    Posts
    435
    Thank Post
    95
    Thanked 18 Times in 13 Posts
    Rep Power
    17
    Thanks guys, I'll give it a try now!

SHARE:
+ Post New Thread

Similar Threads

  1. Hp Procurve default gateway help
    By Andi in forum Wireless Networks
    Replies: 14
    Last Post: 13th October 2008, 02:01 PM
  2. Set Default Gateway for all users
    By link470 in forum Wireless Networks
    Replies: 2
    Last Post: 15th January 2008, 10:30 AM
  3. No Default Gateway for curriculum
    By Lipjam in forum Network and Classroom Management
    Replies: 4
    Last Post: 10th June 2007, 04:13 PM
  4. Default gateway settings etc. help please.
    By tickmike in forum Wireless Networks
    Replies: 21
    Last Post: 17th September 2006, 03:44 PM
  5. Default gateways and proxy server
    By snakepottery in forum Windows
    Replies: 8
    Last Post: 21st November 2005, 02:57 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •