NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Setting default route and specify interface to be used
Hi all :)!
I use two different NICs, Ethernet and WiFi, in a laptop. I need
to change the configuration for gateway, IP and nameservers,
according to the LAN I join. In particular, I would like to set a
static IP address for the WiFi NIC and to set a router as default
gateway. I am currently able to do this, using dhcpcd(8) with a
dedicated `arping' section in dhcpcd.conf(5). But I would like to
avoid running dhcpcd(8) in this scenario, if it is possible.
Suppose that the NIC is initially down. I run:
ifconfig <interface> <static_IP> netmask <mask> up
The route configuration is a problem. In fact, the default routing
table has:
Destination Gateway Flags Refs Use Mtu Interface
default <gateway_IP> UG - - - <Ethernet_NIC>
I would like to have <WiFi_NIC> replacing <Ethernet_NIC>, but I
didn't manage to set this. If I delete the default route, then put
<Ethernet_NIC> down, and re-add the <gateway_IP> route as default,
`Interface' keeps being set to `<Ethernet_NIC>'. In Linux, it is
possible to set the interface, instead:
route add default gw <gateway_IP> <desired_interface>
But the synopsis in NetBSD's route(8) does not apparently accept a
`<desired_interface' parameter.
Is there a way to perform this configuration in NetBSD, as in Linux?
Bye!
Rocky
Home |
Main Index |
Thread Index |
Old Index