LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   2 ip address 1 nic card? (https://www.linuxquestions.org/questions/linux-networking-3/2-ip-address-1-nic-card-203313/)

citrus 07-10-2004 04:09 AM

2 ip address 1 nic card?
 
i have 2 ips from my isp

is it possible to bind both of them to 1 nic card on my linux server
so that i can have the linux server as one IP and 2 other computers connected to the box as a different IP and the other 2 computer connecting to the box via DHCP????

frelihm 07-10-2004 05:01 AM

i would recommend you to use one ip for server. You can make with your two computers a LAN and on server (with ip) you cane use ip masquerading. That means, in your local network, every box has it's own ip, assigned by adminsitrator (you) and when you connect to internet via your server, the server memorizes incoming ip and transforms it into ip, which was given by ISP. So, you need for your server only one ip.

citrus 07-10-2004 05:11 AM

thats not what i want tho

i just want to know if what i want is possible

cuz i need the other 2 computers to have a different WAN IP
theres no way around it

frelihm 07-10-2004 05:19 AM

WAN IP are assigned by YOU, not from ISP, don't you get it?

Your first machine's IP: 192.168.100.100
Your seconds machine's IP: 192.168.100.101

for example, and then if you access to net from either comps, you get:

192.168.100.101 ---> translates to -----> your server's ip and voila, you're winner

ppuru 07-10-2004 06:27 AM

citrus

you can have

eth0:0 IPAddress1
eth0:1 Ipaddress2

with slack t0, you can

ip addr add x.x.x.x dev eth0
ip addr add x x x x1 dev eth0

citrus 07-10-2004 07:07 AM

THANK YOU PPURU

now how would i configure the machine to USE one of the ips for the internet and one of the ips as a dhcp server so my other computers can connect to that?

by the way i haven't ever set up a dhcp server before
so i am going to need a little help

the linux machine has 2 nic cards and i will put the 2 ips on on nice card and then the second card is where i will connect my switch so the other 2 computers will conect to the machine via dhcp thru the other IP

i just want to make sure the first ip is ONLY for the servers internet
and the second one is ONLY for the other computers

thanks in advance

Nichole_knc 07-10-2004 07:48 AM

You want a DMZ and a NAT2LAN rig...

Ok for this to happen with only 2 nics you are going to have to do a bit of hack trickery.
The best method would be to have a router box set up with 3 nics (1 WAN both IPs, routed to- 1 nic, DMZ, 1 nic, LAN). But it can be done on one box.

You will need to insure iptables with NAT is compiled in your kernel as mods. Also you will have to edit the route tables to point the IP you want at the LAN nic.
See the firewall howtos for a good firewall script for NAT and edit accordingly. Doing so will insure that the "server" addy does not pass to the LAN nic. Also this is where the route tables come in ($>man route). It is much the same as making a router.

citrus 07-10-2004 09:58 AM

woah

Nichole_knc 07-11-2004 04:45 AM

Yep quite a bit huh...

Here is where to find the HOWTO to set up a dhcp server using the dhcpd. If you installed the HOWTOS. See the server section. As I pointed out above you also have to "point" the dhcpd to the nic you want to provide dhcp to.
Note: MULTICAST must be complied into the kernel
HOWTO location
usr/doc/Linux-HOWTOs/DHCP


All times are GMT -5. The time now is 02:28 PM.