How to configure Static Routes for SIP trunk on Debian Server hosted on VMware

Status
Not open for further replies.

vincent Kavila

Silver Partner
Advanced Certified
Joined
Mar 26, 2019
Messages
150
Reaction score
20
I have a Debian 10 hosted on VMware, I needed to create static routes on the VM for my SIP trunk, anyone with an idea on how to go about it?
 
3CX itself doesn't handle routing, so either add it static in /etc/network/interfaces (or network manager if using that) or better would be to add it to the upstream gateway and/or DHCP.

I.e., not a 3CX configuration item, it's done in the OS.
 
  • Like
Reactions: vincent Kavila
This worked for me:
The first option is edit /etc/network/interfaces file.

Following is the sample Debian (Ubuntu) network interface configuration file with permanent static route entries.

# The primary network interface
auto ens192
allow-hotplug ens192
iface ens192 inet static
address 192.168.221.54/24
gateway 192.168.221.1
dns-nameservers 82.99.137.41 212.158.133.41
dns-search secar.cz
up ip route del 192.168.0.0/24 via 192.168.221.1 dev ens192
up ip route add 192.168.0.0/24 via 192.168.221.1 dev ens192
up ip route del 192.168.1.0/24 via 192.168.221.1 dev ens192
up ip route add 192.168.1.0/24 via 192.168.221.1 dev ens192
 
Good to know you found your solution however keep in mind that this depends on the OS level.
 
  • Like
Reactions: vincent Kavila
To create static routes on Debian 10 you will need to use the `ip route add` command. Determine the destination IP address and gateway for your SIP trunk. Open a terminal on your Debian 10 virtual machine. This command tells Debian 10 that all packets addressed to the 192.168.1.0/24 network should be sent through the 192.168.0.1 gateway.
 
  • Like
Reactions: vincent Kavila

Configuring Static Routes for a SIP Trunk on Debian (VMware)​

Prerequisites​

  • Running Debian server on VMware.
  • Root or sudo access.

Steps​

  1. Log In:
    • Start your Debian server in VMware.
    • Log in with root or sudo privileges.
  2. Identify Network Interface:
    • Run ip a to find your network interface (e.g., eth0).
  3. Edit Network Configuration:
    • Open the network configuration file:
      sh
      Copy code
      sudo nano /etc/network/interfaces
  4. Add Static Route:
    • Under the relevant interface, add the static route. For example:
      plaintext
      Copy code
      auto eth0
      iface eth0 inet static
      address 192.168.1.2
      netmask 255.255.255.0
      gateway 192.168.1.1
      up route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1
      down route del -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1
  5. Save and Apply:
    • Save the file (in nano: CTRL + X, Y, Enter).
    • Restart networking:
      sh
      Copy code
      sudo systemctl restart networking
    • Or reboot the server:
      sh
      Copy code
      sudo reboot
  6. Verify the Route:
    • Check the static route:
      sh
      Copy code
      ip route

Example Configuration​

For eth0, IP 192.168.1.2, gateway 192.168.1.1, routing to 192.168.2.0/24:
plaintext
Copy code
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
up route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1
down route del -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1
This guide helps you set up static routes for your SIP trunk on a Debian server in VMware quickly and efficiently.
 
Status
Not open for further replies.

Latest Posts

Members Online Now

Forum statistics

Threads
111,832
Messages
589,278
Members
164,662
Latest member
DejanMDS