• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How do I assign an IP address to my linux box?

afropick

Senior member
Hey linux gurus! Question for you all...

I have two machines and a linksys 4 port cable/dsl router (I have cable). I'm using WinXP on my main machine and I've installed Red Hat Linux 7.2 on an old Pentium 166. During Red Hat's setup, I chose server installation and picked the web and ftp server services.

Instead of using DHCP I want to assign the linux box its own ip address so that i can set up the router to forward ftp and http ports to it. I tried this a while back and could only half way get it to work correctly.

Exactly what stpes do I need to take to get this to work in linux? Please be kind, I'm a linux dum dum.
 
try

/usr/sbin/netconfig

this program will let you change the ip address and dns stuff

you probably need to be superuser to do this



 
As I mentioned earlier, excuse me for being a dum dum, but after the netconfig part is where I get a little lost.

I'm not on the box right now, but as far as I remember it asks for and ip address (which I assum I can assign), then it asks for net/subnet mask, domain name server, gateway, etc. (excuse me I'm naming these from memory from a few months ago). I'm confused as to what values to give all of these exactly.

I did a ipconfig /all from the command prompt in Windows and tried to transfer that information to the linux netconfig info. I even got so far at one point as to where you could view the default apache webpage if you typed in the ip address assigned to me from the cable company into a web browser on another workstation. Unfortunately, when that started working, I couldn't use the linux box to access the internet. When the webby doesn't work I can access the web just fine. I'm pretty sure that enabling one shouldn't disable the other, so what am I doing wrong?

I guess if someone could run netconfig and explain what each line is for. I'd greatly appreciate it. I tried all kinds of combos and couldn't get it to work. 😕
 
I dont know anything about netconfig (Im an ifconfig type)

Explanation of basic networking terms you mentioned:

ip: The ip address of the machine
subnet mask: Probably 255.255.255.0
gateway: the linksys router's internal ip
domain name server: The DNS server you use to make domain name requests

man netconfig

 
Okay I'm home now. When I run netconfig (sorry n0cmonkey ifconfig seems a little complex for me right now) it asks these questions:

Use dynamic IP configuration (BOOTP/DHCP)
Which I left unchecked because I want to assign an IP myself

IP address: Where I put the IP address that I'm trying to forward the ports to, ie. the linux box.

Netmask: 255.255.255.0

Default gateway (IP): My router's internal IP address

Primary nameserver: One of the DNS Servers listed when I did ipconfig /all in Windows

I then hit OK.

So what am I doing wrong?
 
If your router is 192.168.1.1 or 192.168.0.1 then your netmask is 255.255.255.0
If you have your router running DHCP for your other machines (your XP machine) it might not recognize a manual IP (not sure on this) because I think that you can either have DHCP on your lan, or not, I dont' know if you can mix.. maybe you can.
Set the linux box IP to 192.168.0.x where x is any number from 1 to 255 (different from your other machines)
If you have DHCP enabled on your router, change it to manual and set your IP in windows too (another 192.168.0.x number)

Give it the proper name servers.. that should do it. Did you do all that stuff like that? Try to keep a constant organizational strategy going on your whole lan, like if you are using DHCP on your windows box, use it on all boxen...

For your gateway.. put in the routers internal IP (as people already mentioned) probably 192.168.0.1 ( you should know this in any case)
Tell us what IP addys you are using and if the windows box is set to get IP via DHCP or not.. how is the router set up?
 
Before I go any further, quick question....

As I said before, during setup I selected www and ftp services.... are these turned on by default?

In the linux distro I used before they were, but it just occured to me that Red Hat may be different. The generic apache index.html file is there under /var/www/html, and during startup there is an [OK] next to web and ftp services, but do i have to do something else?
 


<< Before I go any further, quick question....

As I said before, during setup I selected www and ftp services.... are these turned on by default?

In the linux distro I used before they were, but it just occured to me that Red Hat may be different. The generic apache index.html file is there under /var/www/html, and during startup there is an [OK] next to web and ftp services, but do i have to do something else?
>>



"ps auxww | grep httpd"
 
That appears to have been it. n0cmonkey when I typed that it showed one line and appeared that my assumption about the service not being up was correct.

I typed "httpd" and it appears to have started. When I type my IP address into the browser on my other machine now, the Apache Test Page comes up.

This makes me realize how very little I know about linux. I need to read more. I'm still lost about a lot of things. Now I'd like to get the ftp stuff going. Alas... where to begin?
 
For apache, do a "`which apachectl` start" The `` is important 😛

It depends on what ftp server you are using, but generally it would be ftpd.
 
Back
Top