LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   single ip with multiple ports .....possible?? (https://www.linuxquestions.org/questions/linux-networking-3/single-ip-with-multiple-ports-possible-600806/)

kool_kid 11-19-2007 06:31 AM

single ip with multiple ports .....possible??
 
Hiya

My company got cctv camera's, now there want to assign single ip to about 10 camera but the they want to have access each camera with its port number

example:
cam1 ip >10.0.0.50:80
cam2 ip >10.0.0.50:81
cam3 ip > 10.0.0.50:82

the ip i have chosen is just an example one i want to focus on port number rather than ips.


There is an option to get this done through Router(Netlink router) im eager whether it is possible to do the same using Linux Box (making it as a router)??.

acid_kewpie 11-19-2007 06:32 AM

what's possible depends on what this camera is... are they networked? usb? we can't really help if you don't actually tell us about what these things are. there's certainly no reason you can run multiple web services on different ports, apache can do that without thinking...

rjlee 11-19-2007 07:33 AM

Assuming that the cameras are each connected to the same network, with separate network cards each, then that's not directly possible.

Each IP address on the network relates to one network interface controller (NIC), being one network card. Each NIC can have several IP addresses.

You would have to assign each network card its own IP address, and then set up 10.0.0.50 as a NAT-ing router. You can then redirect ports on the router to point to the various cameras.

e.g. let's say camera 1 is at 10.0.0.1 and camera 2 is at 10.0.0.2, and the router (any old linux box would do) is at 10.0.0.50 as in your example. You can then set up port redirection to forward port 10.0.0.50:80 to 10.0.0.1:80, and 10.0.0.50:81 to 10.0.0.2:80.

You could even set up the cameras on a separate subnet if the number space becomes a problem. The router would just need two IPs , say 10.0.0.50 and 10.0.1.50, and routing table entries to direct both subnets to the card. (Or change the netmask to 255.255.127.0 so the router thinks of it as one subnet, but that can get very confusing).

kool_kid 11-19-2007 08:37 AM

okay here is exactly what i, i just confirmed it lol,

there are camera's and these camera's will in LAN through a switch. Now ppl from other part of the world should be able access all the camera whenever they want (sort of a website kinda service u may think of). So how to achieve this using linux box?

acid_kewpie 11-19-2007 09:19 AM

so these systems already have their own ip address? this sort of translation..?

1.2.3.4:80 --> 1.2.3.7:80
1.2.3.4:81 --> 1.2.3.8:80
1.2.3.4:82 --> 1.2.3.9:80
1.2.3.4:83 --> 1.2.3.10:80

on the linux box (1.2.3.4) this shoudl just be:
iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to 1.2.3.7:80
iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to 1.2.3.8:80
iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to 1.2.3.9:80
iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to 1.2.3.10:80

kool_kid 11-19-2007 09:56 AM

so if any1 wants to check the camera he should issue the ip http://1.2.3.4:80 in the web browser and he will get access to it, am i right?


All times are GMT -5. The time now is 12:28 AM.