# equivalent to ip scope on freebsd?



## benoitc (May 15, 2022)

In liux we can set a address only valid on a device using the scope parameter [1], for example:

```
ip addr add 203.0.113.254/32 dev vnet5 scope link
```

Is there a way to do the same in FreeBSD?

[1] http://linux-ip.net/html/tools-ip-address.html


----------



## Alain De Vos (May 15, 2022)

I have the impression scope in linux is related to the routing table in freebsd.
eg flags of:

```
netstat -rn
```


----------



## benoitc (May 16, 2022)

but how can we flag an ip to be set only for the device? instead of beeing routed at the host level? The idea is to setup multiple tap with the same IP to be be use by the bhyve vm as a gateway. Ie all tap device on the host would have the IP 192.168.1.254.


----------



## SirDice (May 16, 2022)

benoitc said:


> The idea is to setup multiple tap with the same IP to be be use by the bhyve vm as a gateway.


Use carp(4) for this. Each node will have it's own IP address, CARP will create a 'virtual' IP address that 'floats' between those nodes. If one node goes down the other node will get the virtual IP. Your hosts set their gateway to this virtual IP.


----------

