Assign extra public /29 subnet to Freebsd

Hello everyone,

I have a FreeBSD 12 cloud server with a VPS provider(KVM). Recently I have requested a block of /29 public addresses and I am trying to use these for my personal websites.

I changed the network addresses for privacy purposess and will talk with aliases.

Basically my machine gets one public address 10.0.0.78 residing in a /24 with 10.0.0.1. Now the provider gave me a /29 as requested, but the block is on a completely
new network with another gateway.

As I understood, I get basically 5 new addresses since 2 are reserved and 1 should be their router (gateway - 192.168.0.1) that forwards everything to my 10.0.0.78.
Considering that I added 192.168.0.2-6 addresses on my interface and setup the gateway. Also reading on the forum I set the .2 as /29 and then I set every other
address under a /32.

This is my rc.conf that I am currently using:
Code:
gateway_enable="YES"          # Set to YES if this host will be a gateway
ifconfig_vtnet0="inet 10.0.0.78 netmask 255.255.255.0"
ifconfig_vtnet0_alias1="inet 192.168.0.2 netmask 255.255.255.248"
ifconfig_vtnet0_alias2="inet 192.168.0.3-6 netmask 255.255.255.255"
gateway_if="vtnet0"
gateway_ip="10.0.0.1"
net1_net="192.168.0.0/29"
net1_gateway="192.168.0.1"
static_routes="gateway default net1 gateway_net1"
route_gateway="-host $gateway_ip -interface $gateway_if"
route_default="default $gateway_ip"
route_net1="-net $net1_net $net1_gateway"
route_gateway_net1="-host $net1_gateway $gateway_ip"
ifconfig_vtnet0_ipv6="inet6 accept_rtadv"

I am trying to figure out the problem and tried everything possible that I found on this forum and internet but still cannot spot the problem.

At the moment I can't even ping my extra public IPs so any help would be greatly appreciated.
 
There can only be ONE default gateway.

This is an implied route (directly connected network), you don't need to set it:
Code:
route_gateway="-host $gateway_ip -interface $gateway_if"
 
  • Like
Reactions: a6h
There can only be ONE default gateway.

This is an implied route (directly connected network), you don't need to set it:
Code:
route_gateway="-host $gateway_ip -interface $gateway_if"
And it is referred to as the defaultrouter.

You don't need all those variables. Keep it simple.

Look here -
 
Back
Top