Recently, I happened to be searching the man pages of ifconfig on how to add a virtual IP to a unix machine. The examples and the help text was not very helpful and I endedup googling for it. I came across a nice HOw TO article on this and I am providing the content and the link here. I followed the instructions and I was able to create an interface in minutes.
Let’s assume our network card is eri0, and we want to create a virtual interface called eri0:1
Create the virtual interface:
# ifconfig eri0:1 plumb
Configure the virtual interface:
# ifconfig eri0:1 179.164.83.161 netmask 255.255.255.0 broadcast 179.164.83.255
Check to make sure it worked:
# ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
eri0: flags=1000843 mtu 1500 index 2
inet 179.164.83.160 netmask ffffff00 broadcast 179.164.83.255
ether 0:3:ba:9:63:9b
eri0:1: flags=1000842 mtu 1500 index 2
inet 179.164.83.161 netmask ffffff00 broadcast 179.164.83.255
Finally bring up your new virtual interface:
# ifconfig eri0:1 up
To make it come up on start:
create /etc/hostname.eri0:1 with hostname in it
make sure the hostname is in /etc/hosts
Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts
Wednesday, July 9, 2008
Thursday, March 13, 2008
Identifying the process that is listening on a port
There are several times when we try to bring up a process and we get a port conflict. But if you ever wondered which process is running on that port, it is easy to find out.
In most unix systems you can use the lsof command which is normally available under /usr/local/bin/lsof. The only catch is you have to be root or have sudo access to run this command.
lsof -i TCP: will list the process that is listening on . So if you are trying to find out the process id that is listening on port 80, issue the command "lsof -i TCP:80". For more information on the lsof command refer to the manual.
Once you find the process id, you can get more information about the process by using the ps command.
There is a developer works article that has good usage information about lsof.
If your system does not have the lsof command due to security restrictions, you may want to try the script found here.
In most unix systems you can use the lsof command which is normally available under /usr/local/bin/lsof. The only catch is you have to be root or have sudo access to run this command.
lsof -i TCP:
Once you find the process id, you can get more information about the process by using the ps command.
There is a developer works article that has good usage information about lsof.
If your system does not have the lsof command due to security restrictions, you may want to try the script found here.
Subscribe to:
Posts (Atom)