Link to home
Start Free TrialLog in
Avatar of Steves2001
Steves2001

asked on

Accessing a gateway

I am using redhat linux 5.2 as a web server using the version of apache the comes with it.  The server works fine on our network and can be accessed with no problems, subnetting, dns,etc. is fine., but I have been given the ip address of our gateway to the internet (standard ip format) how do I configure the server to use it?

A good clear set of instructions will result in the points being raised by another 30 points.  Many Thanks
Avatar of stefanx
stefanx

I don't know for redhat, but under slackware you simply just add the default gateway in /etc/rc.d/rc.inet1 as follows:

route -add default gw xxx.xxx.xxx.xxx

I don't have a linux box here at home, so just check the exact syntax of that route command by checking the man page i.e man route

Also, remember that the default gateway is a networking issue - it has very little to do with your webserver
Avatar of Steves2001

ASKER

Sorry there is no file called rc.inet1 in the rc.d directory and yes I am aware using a gateway is networking problem thats why I have put it in linux networking section (sorry, that sounded sarcastic)
Try finding the location of the route commands in your /etc/rc.d directory by saying

grep route /etc/rc.d/*


Avatar of Julian Parker
Try this....

o  cd into the sysconfig area.
cd /etc/sysconfig

edit the static routes file using the format below;
vi static-routes

eth0 net x.x.x.x netmask x.x.x.x gw x.x.x.x

Note: x.x.x.x denotes ip address for network and gateway but these can normally be specified as hostnames if dns or /etc/hosts OK.

If you want more information, please post the ip configuration to be added.

J
I have made the changes you suggested in the static-routes file and restarted the server.  The line when used reported that the format was incorrect for the route command.  The line below shows the information added

194.83.167.5 is the server IP
255.255.255.192 is our networks sub net mask
194.83.167.2 is the gateway IP

eth0 net 194.83.167.5 netmask 255.255.255.192 gw 194.83.167.2

I went home and tried to access the server using it's IP address with no success (novell netware was so easy compared to this)
I think I forgot the metric value, try this in static-routes (I'll check and post again if this is crap);

eth0 net 194.83.167.5 netmask 255.255.255.192 gw 194.83.167.2 1

If that doesn't work, can you give ifconfig -a information?

Any other networking (unix or windoze) is easier than this :)

Sorry Steves2001, forget the metric, according to the notes I have it's not reqd in static-routes.

Please post you ifconfig -a output and give a fuller description of the error you are getting on startup.

If you could also list netstat -r output it may help.

cheers

J
Perhaps you should try to add the route manually first, so not in a script, it saves you the trouble of rebooting :)
Thanks I will give that a try on Monday I'm of site at the moment.
And I can't spell I meant off site
try to use "/sbin/netconf".....
sorry i think it should be /bin/netconf
can you ping the gateway from the webserver?

if you can.

type this at the command line

route add default gw 194.83.167.2

You now should be able to ping past the gateway i.e. get out to the net from that machine. If so let me know we will set it up so that it automatic at boot.

The out put of ifconfig and route would be helpful.
I have tried the route command and it worked correctly for pinging internal to yahoo will try accessing from home tonight to see if all is ok (don't try accessing it your self using the domain name as the colleges DNS server has not had it added to its hosts database yet).  I did a little more reading myself and I think I have made correct configuration changes to make it work by changing the /etc/sysconfig/network file, any comments from the experts about whether this is the correct method would be appreciated.  The full file is listed below.


NETWORKING=yes
FORWARD_IPV4=no
HOSTNAME=gcomp
DOMAINNAME=nlincs-coll.ac.uk
GATEWAY=194.83.167.2
GATEWAYDEV=eth0

Not to sure about how to distribute the points yet.
nice looking page, I get to

           Welcome to
           North Lincolnshire College
from the IP address.

your /etc/sysconfig/network is fine. You know that you can manipulate this file from the control-panel app? it is on the routing tab for the networking section.
dagmatic post an answer to this question so I can award you 50 points, jools post a comment if you would like 15 points for the help.  Many thanks to all for the help offered.
Thanks Steves2001, give the pts to dagmatic. Just glad to be of some assistance.

J
ASKER CERTIFIED SOLUTION
Avatar of dagmatic
dagmatic

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
I have and no problems thanks again and thanks jools.