FreeBSD : Configuration d'adresse ip fixe

FreeBSD : Configuration d'adresse ip fixe

1/ Affichage de la configuration de l'interface réseau 'msk0'.

# ifconfig
msk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=c011a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,VLAN_HWTSO,LINKSTATE>
    ether 00:16:d3:65:58:d6
    inet 192.168.1.34 netmask 0xffffff00 broadcast 192.168.1.255
    media: Ethernet autoselect (100baseTX <full-duplex,flowcontrol,rxpause,txpause>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
...

2/ Assignement d'une adresse ipv4 pour l'interface réseau 'msk0'.

# ifconfig msk0 inet 192.168.1.66

3/ Vérification.

# ifconfig
msk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=c011a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,VLAN_HWTSO,LINKSTATE>
    ether 00:16:d3:65:58:d6
    inet 192.168.1.66 netmask 0xffffff00 broadcast 192.168.1.255
    media: Ethernet autoselect (100baseTX <full-duplex,flowcontrol,rxpause,txpause>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
...

4/ Configuration permanente.

  • Ouvrir :
/etc/rc.conf
  • Ajouter :
ifconfig_msk0="inet 192.168.1.66 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
  • Action :
# /etc/rc.d/netif restart
# /etc/rc.d/routing restart