Home › Forums › HAast (High Availability for Asterisk) › Configuration & Optimization › No option to configure gateway for VoIP NIC
-
AuthorPosts
-
I am using the [voipnic] settings in haast.conf and am able to successfully create a vNIC with an address on my vLAN. The command ifconfig shows:
eth0.haast: flags=4163 mtu 1500
inet 10.10.0.4 netmask 255.255.255.0 broadcast 10.10.0.255
ether 02:22:5d:f2:28:ac txqueuelen 1000 (Ethernet)
RX packets 14010138 bytes 3242747570 (3.0 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13347852 bytes 3208082831 (2.9 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
But I don’t see a gateway set above, and there is no gateway setting in the [voipnic] settings. I tried placing the default gateway into a file called ifcfg-eth0.haast file but that isn’t having any effect. Is HAAst missing this setting in the [voipnic] stanza?
Some Linux distributions allow you to configure routing information along with the NIC (in the same NIC configuration file); however, this is misleading – in fact, newer Linux distros no longer allow this practice. Routing information has nothing to do with the NIC. Routing information (eg: default gateway / subnet gateway) is added to the routing table not the NIC.
If you would like to add a route to the routing table from a terminal window then enter a command like:
route add -net 10.10.0.0 netmask 255.255.255.0 gw 10.10.0.1
If you would like this route to persist between reboots you would have to enter this information into a config file/script. If you are using the Commercial Unlimited edition of HAAst then you can add the above line to the pre-start event handler /usr/local/haast/events/asterisk.start.pre This event handler will run before the vNIC is brought up so the route will be present when needed. If you like you can also delete this route by adding a line to the the post-stop event handler /usr/local/haast/events/asterisk.stop.post
If you are not using the Commercial Unlimited Edition of HAAst, then you will need to find the most suitable place for these routing rules (which varies considerably between Linux distributions). In your case I suspect you are using a RedHat flavour of Linux, so you could create a file called /etc/sysconfig/network-scripts/route-eth0 with:
default 192.168.0.1 dev eth0
10.10.0.0/24 via 10.10.0.1 dev eth0
172.16.1.0/24 via 192.168.0.1 dev eth0
but you should check the guides for your Linux distro to confirm the best place to place ‘persistent routes’. If you are looking for routes to be added/deleted based on HAAst events then you should use the HAAst event handler instead.
-
AuthorPosts
- You must be logged in to reply to this topic.