Quelle: http://www.cyberciti.biz/tips/freebsd-how-to-setup-2-ip-address-on-one-nic.html
> arp -an
Netzwerk neu starten
> /etc/rc.d/netif restart
eine IP auf eine Netzwerkkarte legen:
> ifconfig em0 10.20.110.2 netmask 255.255.255.192
eine Alias-IP (zweite, dritte, …) auf eine Netzwerkkarte legen:
> ifconfig em0 192.168.1.5 netmask 255.255.255.255 alias
Netzwerk neu starten:
> /etc/rc.d/netif restart && /etc/rc.d/routing restart
IPs anzeigen:
> ifconfig em0
NIC-CFG für die Netzwerkkarte "sk0" restarten:
> /etc/rc.d/netif restart sk0
DHCP auf der Kommandozeile für die Netzwerkkarte "sk1" starten:
> /etc/rc.d/dhclient start sk1
Beispiel:
hostname="sun.nixcraft.in" # default vsnl router interface defaultrouter="202.54.1.200" # Force 10Mbps for both public and private LAN interace ifconfig_em0="inet 10.20.110.2 netmask 255.255.255.192 media 10baseT/UTP mediaopt full-duplex" ifconfig_em1="inet 202.52.1.2 netmask 255.255.255.248 media 10baseT/UTP mediaopt full-duplex" ifconfig_em0_alias0="inet 10.20.1.226 netmask 255.255.255.0" ifconfig_em0_alias1="inet 10.20.1.227 netmask 255.255.255.0" ifconfig_em0_alias2="inet 10.20.1.228 netmask 255.255.255.0" ifconfig_em0_alias3="inet 10.20.1.229 netmask 255.255.255.0" ifconfig_em0_alias4="inet 10.20.1.230 netmask 255.255.255.0" # static routing configuration static_routes="lan0" route_lan0="-net 10.0.0.0/8 10.20.110.1"
> vi rc.conf ... # -- Main IP (Claas C) ifconfig_xl0="inet x.x.x.x/24" # -- Aliases ifconfig_xl0_alias0="inet alias x.x.x.x/32 ifconfig_xl0_alias1="inet alias x.x.x.x netmask 0xffffffff" ifconfig_xl0_alias2="inet alias x.x.x.x netmask 255.255.255.255" #------------------------------------------------------------------------------# ifconfig_fxp0="inet 192.168.22.2/24 media 100baseTX mediaopt full-duplex" ifconfig_fxp0_alias0="192.168.22.3 netmask 0xffffffff" ifconfig_fxp0_alias1="192.168.22.4 netmask 0xffffffff" ifconfig_fxp0_alias2="192.168.22.5 netmask 255.255.255.255"
# ein zweites Netz auf die Karte legen:
ifconfig_fxp0_alias3="192.168.122.2 netmask 0xffffff00" ifconfig_fxp0_alias4="192.168.122.3 netmask 0xffffffff" ifconfig_fxp0_alias5="192.168.122.4 netmask 255.255.255.255" ifconfig_fxp0_alias6="192.168.122.5/32" #------------------------------------------------------------------------------# ...
auf der Kommandozeile Aliase hinzufühgen:
> ifconfig xl0 alias inet alias x.x.x.x/32 > ifconfig xl0 alias inet alias x.x.x.x netmask 0xffffffff > ifconfig xl0 alias inet alias x.x.x.x netmask 255.255.255.255
> ifconfig fxp0 inet 192.168.22.2/24 media 100baseTX mediaopt full-duplex > ifconfig fxp0 alias 192.168.22.3 netmask 0xffffffff > ifconfig fxp0 alias 192.168.22.4 netmask 0xffffffff > ifconfig fxp0 alias 192.168.22.5 netmask 255.255.255.255
> ifconfig fxp0 alias 192.168.122.2 netmask 0xffffff00 > ifconfig fxp0 alias 192.168.122.3 netmask 0xffffffff > ifconfig fxp0 alias 192.168.122.4 netmask 255.255.255.255 > ifconfig fxp0 alias 192.168.122.5/32
einen Alias entfernen:
> ifconfig fxp0 -alias 192.168.22.5/32
> vi /etc/rc.conf ... ################################################################################ ### Network routing options: ### defaultrouter="192.168.22.1" # # Statische Routen static_routes='ZUSATZROUTE01 ZUSATZROUTE02' # route_ZUSATZROUTE01="192.168.80.0/24 212.168.80.1" # route_ZUSATZROUTE02="192.168.122.0/24 212.168.122.1" ################################################################################
eine Route hinzufühgen:
> route add -net 192.168.122.0 192.168.122.1 255.255.255.0
oder:
> route add -net 192.168.122.0/24 192.168.122.1
Routen anzeigen:
> netstat -rn
eine Route ändern:
> route change default 192.168.22.1
eine Route löschen:
> route delete 192.168.122.0
> vi /etc/rc.conf ... # Diese Einstellung ermoeglicht eine Verbindung zwischen mehreren # Netzwerkinterfaces (NIC). # Zum Beispiel zwischen einer ISDN-Karte und einer Netzwerkkarte oder # zwischen mehreren Netzwerkkarten. gateway_enable="YES" ... # Diese Einstellung ermoeglicht eine Verbindung zwischen verschiedenen # Netzen. Siehe "route" und "netstat -rn". router_enable="YES"
meine Faforiten:
> systat -ifstat > bmon > iftop
weitere:
> netstat 1
> systat -ifstat
> cd /usr/ports/net/bmon/ && make clean && make && make install && make clean > bmon
> cd /usr/ports/net-mgmt/iftop/ && make clean && make && make install && make clean > iftop
> cd /usr/ports/net/trafshow/ && make clean && make && make install && make clean > trafshow
> cd /usr/ports/sysutils/pftop/ && make clean && make && make install && make clean > pftop
sonstige:
> cd /usr/ports/net/ntopng/ && make clean && make && make install && make clean
...
===> Cleaning for rrdtool-1.8.0_1
===> Cleaning for libzmq4-4.3.4
===> Cleaning for xmlto-0.0.28
===> Cleaning for norm-1.5r6_2
===> Cleaning for openpgm-5.2.122_6
===> Cleaning for ndpi-4.4.d20220714,1
===> Cleaning for hiredis-1.0.2
===> Cleaning for lua54-5.4.2
===> Cleaning for ntopng-5.4.d20220812,1
...
> ntopng -i em0
> ntopng -i tcp://192.168.1.1:443
> echo "ntopng_enable=YES" >> /etc/rc.conf
> /usr/local/etc/rc.d/ntopng start
> netstat -anp tcp | grep -F 3000
> /var/lib/flatpak/exports/bin/org.mozilla.firefox --new-tab http://192.168.1.1:3000/
default-login
Benutzername: admin
Passwort: admin
> cd /usr/ports/sysutils/slurm-wlm/ && make clean && make && make install && make clean