Link to home
Start Free TrialLog in
Avatar of e1337coderz
e1337coderz

asked on

Binding IP addresses to netcard

I have a dedicated server from ev1servers.com, they give you full root access to a server and you pay only $99/month. Great! Now, I got a few Counter Strike servers running on the server, with custom ports, which I hate. I want to use default ports. So I go ahead and get a few more static IP addresses for my server, now I need to binf these IP addresses to the netcard so I would be able to use them.

I am a linux newbie. I have absolutely no experience on dealing with linux.

I want to be certain that when I add these IP addresses, that the server will not mess up and then not work. I have a business running on it (httpd) that needs to be running 24/7. And that is why I put so many points.

Specs:
RedHat Linux 9 (I havent really messed with any files yet)
I want to add these IP addresses without interruping the connections on the httpd server (very important)

Thank you
Avatar of Gabriel Orozco
Gabriel Orozco
Flag of Mexico image

as Glen said some time ago:


a bit more "redhat style" :-) make a copy of the file /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-eth0:1, edit the file (it should be fairly obvious what'd need be set... DEVICE=eth0:1 etc etc:-). Bring the interface down with "ifdown eth0" and up again with "ifup eth0" ... and check with "ifconfig" that the alias(es) were brought up correctly too.


later you can do

apachectl graceful

and when apache is down, you can restart it with

apachectl start

and you'll not disturb any connection because apache will go down only when no connections are live.

you can also do this more handy with:
apachectl graceful ; apachectl start

---------
the more faster way to do the ip aliasing is with

ifconfig eth0:1 NEW.IP.ADDRESS netmask NETMASK up
you can add a new ip just varying the :1 to be :2 and so on until :32767 (I don't believe you have so many ip's)


hope this help
Avatar of e1337coderz
e1337coderz

ASKER

"Bring the interface down with "ifdown eth0" and up again with "ifup eth0""
Umm, I am SSHing to a box, If i use that command (ifdown eth0), won't that disconnect my SSH connection? What do I do after that command has been executed? I won't be able to SSH back to my box to do "ifconfi up".

What I am interested in is the faster way: I really don't care anymore if it disconnects a few people that are downloading.
I just need to be sure that If I use that command, it won't disconnect me off ssh before being able to fix it...
yeah vlans are a really good solution for this problem.

e1337coderz: there's no way around disconnecting your ssh session, because the interface will go down anyway.
of course you do not want to use ifconfig eth0 down, because network won't come up again ;)
just restart your network startscript after altering the configuration.
but double check your settings are correct.
Why bring down the eth0 ?

Just add the aliases:

ifconfig up eth0:<n> <ipaddress> ...

also edit the redhat-config files as stated above to ensure that after a reboot all your extra addresses remain in place
once you add the files... in red hat just do

service network restart

that brings everything down then back up again.

SSH will wait before disconnecting to so once the network is back up your ssh session SHOULD just resume.  If you do happen to get disconnected simply re-ssh in.. do

ifconfig -a

and make sure all your aliases are there..
ASKER CERTIFIED SOLUTION
Avatar of Gabriel Orozco
Gabriel Orozco
Flag of Mexico image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial