Solved Basic Question for Multiple Gateways using Multiple Static IP's please!

Since we cannot use default_route= more than once. How does one add a second? I can't seem to find the correct documentation to help me understand this in BSD! Thank you very much and Merry Christmas!
 
I looked at your subject line again, and conclude that you probably want to implement static routes. It's in section 31.2.2 of the handbook:
Code:
Using more than one string in static_routes creates multiple static routes. The following shows an example of adding static routes for the 192.168.0.0/24 and 192.168.1.0/24 networks:

gateway_enable="YES"          # Set to YES if this host will be a gateway
static_routes="net1 net2"
route_net1="-net 192.168.0.0/24 192.168.0.1"
route_net2="-net 192.168.1.0/24 192.168.1.1"
 
FreeBSD can implement multiple routing tables (and thus multiple default routes) but I suspect that's probably not what you are enquiring about.

Would you please give us some more information about the specifics of the problem you are trying to solve?

The handbook may help.

Absolutely gpw928 and thank you so much for assisting me. I really appreciate your break down. I attempted another guide (I don't know where it was; my computer ended up crashing and I lost the tab I was on). It had to do with "fibs"; so I am not sure if I broke it before I attributed your solution below.
 
I looked at your subject line again, and conclude that you probably want to implement static routes. It's in section 31.2.2 of the handbook:
Code:
Using more than one string in static_routes creates multiple static routes. The following shows an example of adding static routes for the 192.168.0.0/24 and 192.168.1.0/24 networks:

gateway_enable="YES"          # Set to YES if this host will be a gateway
static_routes="net1 net2"
route_net1="-net 192.168.0.0/24 192.168.0.1"
route_net2="-net 192.168.1.0/24 192.168.1.1"

That is probably the best short line explanation as far as what I believe I have been looking for. Like I said above; I think I broke the networking prior to applying your solution to this server's network configuration.

I applied the following to the existing /etc/rc.conf:

gateway_enable="YES"
static_routes="gw1 gw2"
route_gw1="-net 104.x.16.0/24 104.36.16.1"
route_gw2="-net 185.x.4.0/24 185.12.4.1"

### Existing Network Configuration

ifconfig_em0="104.x.16.185 netmask 255.255.255.0"
ifconfig_em1="104.x.16.37 netmask 255.255.255.0"
ifconfig_em2="104.x.16.72 netmask 255.255.255.0"
ifconfig_em3="185.x.4.102 netmask 255.255.255.0"

### Had this (don't know how to disable the other commands I did previous regarding fibs). I still do not understand fibs.
#defaultrouter="104.x.16.1"
#static_routes="fibdefault fib2"
#route_fibdefault="default 104.x.16.1 -fib1"
#route_fib2="default 185.x.4.1 -fib2"

Now I am receiving the following on start-up:

add net default: gateway 104.x.16.1 fib 0
Additional inet routing options: gateway=YES.
add host ::1: gateway lo0 fib 0: route already in table
add host ::1: gateway lo0 fib 1: route already in table
add net fe80::: gateway ::1 fib 0, 1
add net ff02::: gateway ::1 fib 0, 1
add net ::ffff::: gateway ::1 fib 0, 1
add net ::0.0.0.0: gateway ::1 fib 0,1
Creating and/or trimming log files.
Starting syslogd.
STarting named.
Clearing /tmp.
Updating motd:.
Mounting late filesystems:.
Configuring vt: blanktime.
Performing sanity check on sshd configuration.
Starting sshd.
Starting cron.
Starting background file system checks in 60 seconds.

Sat Dec 14 07:28:52

FreeBSD/amd64 (domain+TLD) (ttyv0)

login:
 
gpw928,

Doing the above seemed to fix the networking issue that was taking place and even preventing SSH connections. I appreciate that. I then tried to change the SSH listening IP to the 185.x IP and received the following message on start-up. This is the same message I was getting prior which prompted me to try and resolve this in the first place.

"Dec 14 07:33:55 domainTLD sshd[91338]: error: Bind to port [x] on 185.x.12.4.102 failed: Can't assign requested address.
"Dec 14 07:33:55 domainTLD sshd[91338]: fatal: Cannot bind any address."

Thank you again for your time. Much obliged!
 
That "x" is not valid in an IP address. On the information provided, you probably want:
Code:
gateway_enable="YES"
static_routes="gw1 gw2"
route_gw1="-net 104.36.16.0/24 104.36.16.1"
route_gw2="-net 185.12.4.0/24 185.12.4.1"

ifconfig_em0="104.36.16.185 netmask 255.255.255.0"
ifconfig_em1="104.36.16.37 netmask 255.255.255.0"
ifconfig_em2="104.36.16.72 netmask 255.255.255.0"
ifconfig_em3="185.12.4.102 netmask 255.255.255.0"

It's a little bit unusual to have three NICs (em0, em1, and em2) on the same subnet (104.36.16.0/24) -- which is why you need the static routes.
 
That "x" is not valid in an IP address. On the information provided, you probably want:
Code:
gateway_enable="YES"
static_routes="gw1 gw2"
route_gw1="-net 104.36.16.0/24 104.36.16.1"
route_gw2="-net 185.12.4.0/24 185.12.4.1"

ifconfig_em0="104.36.16.185 netmask 255.255.255.0"
ifconfig_em1="104.36.16.37 netmask 255.255.255.0"
ifconfig_em2="104.36.16.72 netmask 255.255.255.0"
ifconfig_em3="185.12.4.102 netmask 255.255.255.0"

It's a little bit unusual to have three NICs (em0, em1, and em2) on the same subnet (104.36.16.0/24) -- which is why you need the static routes.
gpw928,

Thank you again. I did the x for security; sorry for the confusion. Thank you very much for your response. I will try this and report back! Using static routes doesn't require fibs from what I am seeing?
 
I realize this thread is a few years old, but this was helpful. I made a similar configuration based on this one.

Code:
defaultrouter="192.168.1.254"
static_routes="path2"
route_path2="-net 192.168.1.0/24 192.168.3.254"
I have my main router, and can access the other router in that LAN. Both are accessible and both interfaces have IP's in line with these two routers.
 
I have a wireless access point/gateway, and a primary gateway with an ethernet cable. I want my computer to access both, because it needs to configure both. It needs to have at least one connection running, because sometimes my wired interface wants to act up (either the hardware is getting old, or unclean shutdowns cause those files needed for that driver to temporarily mess up). It's better that the ethernet interface on my FreeBSD computer goes to the highest level gateway. The wireless gateway is also needed for other devices.

This works, and makes my internet access run better. I could use the method as described in this thread, if I run into problems later.
 
Back
Top