LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Networking 101 WAN IP and private IP (http://www.linuxquestions.org/questions/linux-networking-3/networking-101-wan-ip-and-private-ip-880919/)

iPatch 05-15-2011 11:02 PM

Networking 101 WAN IP and private IP
 
Alright, I recently just upgraded from humble Linux user to confused Linux admin of my own virtual Linux server. When I issue the ifconfig command I get following output.

Code:

venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
          inet addr:1.2.3.4  P-t-P:1.2.3.4  Bcast:1.2.3.4  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

The WAN IP of the interface is not really 1.2.3.4 I just changed that IP for security reasons.

What I am trying to figure out, is it possible to assign a private IP address to the same interface or can I only have one IP address per interface. I understand I have a mask of /32 so I am not going to be able to subnet the address to create any more addresses, so I assume I am stuck with the WAN IP (public IP) that I have, and just need to deal with it.

The reason I ask this is because I have been reading through several DNS/BIND tutorials/walk-throughs, and a lot of them specify setting up a intranet access with 192.168.1.1 address for the local DNS server, but since I am connecting to the sever via SSH I figure I do not need a private IP address.

Any thoughts?

kbp 05-16-2011 12:24 AM

What was your purpose for setting up bind ? ...

iPatch 05-16-2011 11:31 AM

Quote:

Originally Posted by kbp (Post 4357491)
What was your purpose for setting up bind ? ...

So I could host a website, and SSH into the box without having to type the WAN IP.

manyrootsofallevil 05-16-2011 11:58 AM

Quote:

Originally Posted by iPatch (Post 4358005)
So I could host a website, and SSH into the box without having to type the WAN IP.

you can always add a second ip address to the interface

ifconfig interface add 192.168.1.1. 255.255.255.0

Assuming that your private network is 192.168.1.0

Note that this will disappear after a reboot, so make sure that you make the change permanent, if this is what you actually want.

easiest way is to make a copy of the current interface file, e.g. ifcfg-eth0. Rename it to ifcfg-eth0:0 and then change the device name to the file name and the ip address/netmask in ifcfg-eth0:0 to what you need.

Hope this helps

edit

You probably want venet0:1 as you already have :0. Not familiar with your distro I'm afraid.

Also, you'll only be able to access the private ip if you are already in that network 192.168.1.0 (or if there is routing/NATing to this network)

kbp 05-16-2011 07:03 PM

As it's hosted you won't be able to use private addresses without a vpn of some kind, I'd just add an entry in c:\windows\system32\drivers\etc\hosts to ssh. To host a website you'll need a domain registered, most registrars will host the dns for you as well if requested.

scheidel21 05-16-2011 07:18 PM

Or use a dns service like dyndns, no-ip etc.... You don't need to set up BIND on your own server to do DNS you would really only do that on your own internal network.


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