Thursday, September 9, 2010

Plumb the IP Address (ifconfig)

'ifconfig -a' that will show you all your ports and there name, netmask and everything else you could need to knwo about the card/port.

output :
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
hme0: flags=1000843 mtu 1500 index 2
inet 163.37.178.200 netmask ffffffe0 broadcast 163.37.178.223
ether 8:0:20:aa:45:f3

[ If executed as normal user, except the "ether" information
U will get the rest as stated above]

Interpretation from above output :
(a) lo0 & hme0 are the interface names
lo0 is for internal network, hme0 is for external network
(b) numbers given after "inet" are the IP Addresses
for the corresponding Interface
(c) address specified after "ether" is the MAC/Ethernet
address for the Interface Card (only for external cards)
(d) similarly netmask & broadcast addresses are specified




So run a 'ifocnfig -a' the first result will always be 'le0' or 'lo0' forget about that one. Never worry about that. Say you got a quad fast ether net card. You'll then have 4 more results after that. Say hme0 hme1 hme2 hme3, there's your 4 ports you can use (hmex is a example could be qfex or whatever).

Say you want to change hme2 from 192.168.0.1 with netmask of 255.255.0.0 to 192.165.0.1 with a netmask of 255.255.255.0 then you would type the follow command.

ifconfig hme2 plumb up 192.165.0.1 netmask 255.255.255.0

That will change the port. I perfer to unplumb the port first to make sure the above command will work.

Ok so a full set of commands I would type to make the above changes would be.

ifconfig hme2 unplumb (this will bring down port hme2 so it's not used any more)
ifconfig -a (just to make sure the port is no longer used)
ifconfig hme2 plumb up 192.165.0.1 netmask 255.255.255.0 (this will bring port hme2 up with the IP address of 192.165.0.1 and a netmask of 255.255.255.0)
ifconfig -a (just to confirm the changes)

No comments:

Post a Comment