Date: Thu, 14 Jan 1999 21:44:10 -0600 (EST) From: Mark Turpin <yoonix@fidnet.com> To: Andrzej Szydlo <andrzej@maciek.gv.edu.pl> Cc: sysadmin@skynetweb.com, freebsd-questions@FreeBSD.ORG Subject: Re: IP Aliasing... Message-ID: <Pine.LNX.4.04.9901142129260.17889-100000@two.fidnet.com> In-Reply-To: <19990113082325.F13581@gv.edu.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
Here is what I do:
wave# ifconfig ed1 (do this to get the MAC address)
ed1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 209.74.175.2 netmask 0xffffffc0 broadcast 209.74.175.63
ether 00:40:f6:34:4b:19
wave# ifconfig lo0 (just to show you what I have as default)
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
<snip to save space>
wave# ifconfig lo0 alias 209.74.175.61 (ifconfig it)
wave# arp -s 209.74.175.61 00:40:f6:34:4b:19 pub (arp it)
wave# ifconfig lo0 (look at it and see it there)
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
inet 209.74.175.61 netmask 0xffffff00
wave# arp -an (check that its here too)
? (209.74.175.61) at 0:40:f6:34:4b:19 permanent published (proxy only)
^-these get replaced by hostnames if you drop of the 'n' on arp -an
wave# ping -c 1 -s 1 209.74.175.61
PING 209.74.175.61 (209.74.175.61): 1 data bytes
9 bytes from 209.74.175.61: icmp_seq=0 ttl=255
--- 209.74.175.61 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
badda boom. an aliased ip. now, netstat -rn outputs this:
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 209.74.175.1 UGSc 45 32056 ed1
127.0.0.1 127.0.0.1 UH 1 520 lo0
209.74.175.61 209.74.175.61 UH 0 6 lo0
209.74.175.61 0:40:f6:34:4b:19 UHLS2 0 0 ed1
Now, if you want these nifty routes to show back up when you reboot your
machine, do this:
echo "sh /etc/rc.ip_aliases" >> /etc/rc.local
echo "/sbin/ifconfig lo0 alias ip.you.want.to.alias" >> /etc/rc.ip_aliases
echo "/usr/sbin/arp -s ip.you.want.to.alias mac:address:of:net:card pub" \
>> /etc/rc.ip_aliases (i ran out of room, don't put the \ here)^^
chmod 700 /etc/rc.ip_aliases
that /should/ be it.
its easy folks.
(now to critique what you were saying =)
On Wed, 13 Jan 1999, Andrzej Szydlo wrote:
=>On Mon, Jan 11, 1999 at 08:34:26PM -0500, Phillip Ryker - System Administrator wrote:
=>> I have been using the 'ifconfig' command in conjunction with the 'route'
ifconfig good, route? eek.
=>> command to add ip aliases to the ethernet interface in my freebsd box.
=>> After experimenting a little I have found that I do not need to use the
=>> 'route' command at all for the addresses to work.
yah that is right.
=>>
=>> I simply use:
=>>
=>> ifconfig vx0 inet 208.239.248.xxx netmask 255.255.255.xxx alias
=>>
=>> and it adds the ip numbers and the route in the kernels routing table.
pretty much, but you need to tell the network card about it (arp).
=>> My question is: Do I really need to be adding a route for each IP or can
=>> I just simply use the 'ifconfig' command to add ip aliases?? What is the
=>> CORRECT way of doing this?? I only ask because after going through the
=>> e-mail archives and tutorials I have seen examples in using both.
=>
=>It depends on what you want to achieve, but if it works without "route", you
=>don't need it in this case.
=>
=>Andrzej
well. i guess everyone has their way of doing things. in linux you can
use the route command like crazy for their eth0:0/1/2/etc int's and more.
anyway! go with arp i think its the easiest, and i /know/ it works on
freebsd.
-geek
yoonix@fidnet.com
800.392.8070 x214
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.04.9901142129260.17889-100000>
