Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

The instructions for setting up a LAN, which I assume would allow me to create a sub-domain on my VPS, are the following using the command-line on CentOS:

Using sudo, create the configuration file /etc/sysconfig/network-scripts/ifcfg-eth0:0 with the following:

DEVICE=eth0:0
BOOTPROTO=none
ONPARENT=yes
TYPE=Ethernet
IPADDR=$ADDITIONAL_IP$
NETMASK=255.255.255.0
GATEWAY=XXX.XXX.XXX.1
NAME=eth0:0

If you are using a LAN address, it doesn't require a gateway address and would use 255.255.0.0 for the netmask and then you would restart apache.

So for LAN IP insert IPADDR=$some ip$? Is GATEWAY left as is or deleted? How do I state the name of my subdomain?

After restart I am getting this :

 -bash-4.1# /etc/init.d/network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  /etc/sysconfig/network-scripts/ifup-aliases: line 174: ipseen_eth0myLAN_IP$=ifcfg-eth0:0: command not found
error in ifcfg-eth0:0: already seen ipaddr eth0myLAN_IP$ in $
share|improve this question
    
Agreed, I am not adding a new IP but don't I have to create the file above for LAN? –  freja Dec 1 '12 at 0:29
    
I just edited that file by taking out command symbol around LAN IP address and the restart went through ok but I have no idea what it has achieved. –  freja Dec 1 '12 at 0:38
    
Yes, if you want to run a Local Area Network (LAN) or VPN within your VPS environment, using a private address space like 192.168/16 or 10/8. It's not quite clear what your desired end result is. –  dartonw Dec 1 '12 at 0:43

4 Answers 4

I assume you want to give your server a static IP address. So for example if you are building a LAN that won't have more than 254 devices with IP addresses, then you can define the following for a LAN using the private IP space 192.168.2.0

NETMASK: 255.255.255.0
Gateway: 192.168.2.1 (this is the IP address of your router, if you have one)
IPADDR: 192.168.2.2 (pick an unused IP address within your local LAN)

to see how it was configured after boot up, run the following command

ifconfig
share|improve this answer
    
stackoverflow.com/questions/9658890/… This is exactly what I am trying to do. –  freja Dec 1 '12 at 12:46
    
understood. you are mixing two different things, so let's make sure we have the first issue fixed before moving on to the next. is your base tcp/ip working? you have your ip address working, and the server can go outside of your lan (assuming you want that) and others from outside your lan can access your server (just the ip address)? if you only want internal - can the other pc's on your internal lan ping your servers ip address and vice-versa? AFTER you verify this, then we address the question you reference in the link in your comment. –  Johnnie Dec 1 '12 at 17:26
    
Thanks John , so LAN is local area network - ok the penny has dropped. No I don't need to worry about that at this stage because I work by myself. –  freja Dec 1 '12 at 23:31
    
Ok. So what is the complete picture? Are u trying to access a web page from outside your local area network? And how are u wanting it to be accessed - e.g., http://www.myhost.mydomain? –  Johnnie Dec 2 '12 at 0:52
    
I have done it in my own weird way now but I'm sure even though it works it is wrong. I created a conf file in /etc/httpd/conf.d –  freja Dec 2 '12 at 3:15

I think there is some typo mistake in your IPADDR variable, please check the following one.

DEVICE=eth0:0
BOOTPROTO=none
ONPARENT=yes
TYPE=Ethernet
IPADDR=$ADDITIONAL_IP
NETMASK=255.255.255.0
GATEWAY=XXX.XXX.XXX.1
NAME=eth0:0

But the variable named ADDITIONAL_IP must be declared or it will give other error:

error in ifcfg-eth0:0: didn't specify device or ipaddr
share|improve this answer

I am not sure what you are trying to achieve here.

The steps that you are following is for the configuration of IP aliasing. What it does is configure multiple virtual interfaces on a single network card.

For example, your main interface might be configured in the following manner.

#/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0  
ONBOOT=yes 
NETMASK=255.255.255.0
IPADDR=192.168.1.1

To create a virtual interface, you will configure the following.

#/etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0  
ONBOOT=yes 
NETMASK=255.255.255.0
IPADDR=192.168.1.2
share|improve this answer
    
At this very moment my domain is only working strangely without www and the sub domain pointing to main domain also not working if you put www in the address. What is even stranger to me is on my providers dns panel if you input the www address in A-record it wants to put the sub domain name before the www. so messed up. –  freja Dec 1 '12 at 12:42

Creating virtual LANs (what you're attempting to do here) has nothing to do with creating HTTP virtual hosts (your actual objective).

There is evidently a syntax error in /etc/sysconfig/network-scripts/ifcfg-eth0:0 or some other file. Note that IPADDR= should be followed by an IP address, e.g. IPADDR=198.51.100.42, with no $ signs. But what all this does is create another IP address for your server, which no one would know to contact (and which your VPS provider would not route, for that matter).

To allow your server to be reached under several names, you need to create multiple DNS entries, all pointing to your server's IP address. Your DNS provider probably has a web interface where you can declare multiple names pointing to your IP address. (If you're getting DNS and web hosting from the same provider, beware that some cheap VPS packages might require you to pay extra.) Declare an A record for each of yabbit.net, burra.yabbit.net, www.yabbit.net, www.burra.yabbit.net. You may be able to provide a wildcard record for *.yabbit.net that points any host name under yabbit.net to the same address.

Once you've set up the DNS, requests from web browsers will reach your server. Note that it can take some time for DNS records to be updated, as these are heavily cached. You may want to set a lower TTL while you're debugging, then crank it back up for performance.

The next stage is to configure your web server so that it knows what pages to serve depending on the host name. This is known as (name-based) virtual hosting. With Apache, this is done through virtual host configuration.

share|improve this answer
    
Yes I have already worked out all of the above but problem I am now having is 'WSOD' where trying to migrate tables and sites has thrown errors I have yet to fix. Believe has everything to do with virtualhosts I have set up. –  freja Dec 4 '12 at 1:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.