Hitchhiker's Guide to Openbsd
- Setting up aliases on an interface
Download 1.27 Mb. Pdf ko'rish
|
obsd-faq49
6.2.8 - Setting up aliases on an interface
OpenBSD has a simple mechanism for setting up IP aliases on an interface. To do this simply edit the file /etc/hostname. . This file is read upon boot by the /etc/netstart(8) script, which is part of the rc startup hierarchy . For the example, we assume that the user has an interface dc0 and is on the network 192.168.0.0. Other important information: ● IP for dc0 is 192.168.0.2 ● NETMASK is 255.255.255.0 A few side notes about aliases. In OpenBSD you use the interface name only. There is no difference between the first alias and the second alias. Unlike some other operating systems, OpenBSD doesn't refer to them as dc0:0, dc0:1. If you are referring to a specific aliased IP address with ifconfig, or adding an alias, be sure to say " ifconfig int alias " instead of just " ifconfig int " at the command line. You can delete aliases with " ifconfig int delete ". Assuming you are using multiple IP addresses which are in the same IP subnet with aliases, your netmask setting for each alias becomes 255.255.255.255. They do not need to follow the netmask of the first IP bound to the interface. In this example, /etc/hostname.dc0, two aliases are added to the device dc0, which, by the way, was configured as 192.168.0.2 netmask 255.255.255.0. # cat /etc/hostname.dc0 inet 192.168.0.2 255.255.255.0 NONE media 100baseTX inet alias 192.168.0.3 255.255.255.255 http://www.openbsd.org/faq/faq6.html (8 of 33)9/4/2011 10:02:06 AM 6 - Networking inet alias 192.168.0.4 255.255.255.255 Once you've made this file, it just takes a reboot for it to take effect. You can, however, bring up the aliases by hand using the ifconfig(8) utility. To bring up the first alias you would use the command: # ifconfig dc0 inet alias 192.168.0.3 netmask 255.255.255.255 (but again, a reboot is recommended to make sure you entered everything as you expected it to be!) To view these aliases you must use the command: $ ifconfig -A dc0: flags=8863 media: Ethernet manual inet 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255 inet 192.168.0.3 netmask 0xffffffff broadcast 192.168.0.3 Download 1.27 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2025
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling