PDA

View Full Version : How to determine IP & Gateway addresses


DeanRIowa
7th April 2008, 01:20 AM
How can I determine my IP Address and Gateway address?

thanks,
Dean

Hlingler
7th April 2008, 01:36 AM
I assume you mean that you need to know what numbers to put into Network Config to setup networking.

That depends on your hardware setup. For a desktop, you could use static numbers, a good guess would be eth0 IP=192.168.0.1 and gateway=192.168.1.1, but those are just guesses without knowing some more info....

V

scottro
7th April 2008, 01:44 AM
If you mean an existing gateway and so forth you can find your current IP address with /sbin/ifconfig eth0 (or whatever card is your main card.) To get the gateway you can use route -n or netstat -r--sigh, I don't have Fedora open at the moment (or any Linux, I'm in BSD, and I've forgotten the exact syntax, but one or both of those should have a line giving the gateway.

If it's a matter of determining what IP and gateway to enter, as Hingler says, we need more information as to what you're trying to do. His guesses work if you are, for example, configuring a home network plugged into a Linksys router. (Such a router, however, will actually give the individual machines an IP address and gateway.)

So, if you explain the situation a bit more fully, we can give more help.

DeanRIowa
7th April 2008, 01:45 AM
I want to find my current IP. I want the linux version of the windows comannd "ipconfig"?

thanks,

Dean

stevea
7th April 2008, 01:48 AM
ifconfig and route are deprecated.

To see the current setup you should use
ip addr
ip route

*normally* your router or your ISP makes the gateway address and perhaps the IP & mask available via dhcp protocol. The best network config is a completely automated config. DO let dhcp to the work if possible.

Hlingler
7th April 2008, 01:49 AM
Interestingly, it's: ifconfig

V

stevea
7th April 2008, 01:53 AM
Interestingly, it's: ifconfig

V

Huh ? I don't see a typo. What are you saying ?

[edit]

see it - doh !

DeanRIowa
7th April 2008, 01:57 AM
I tried and got:
[root@fedora-vm sbin]# ifconfig eth0
bash: ifconfig: command not found


Any ideas?

thanks,

Dean

Hlingler
7th April 2008, 01:59 AM
Only root can do this:[Vince@presario Sun Apr 06 20:34:00 ~]$ su -
Password:
[root@presario Sun Apr 06 20:58:55 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:18:F3:36:1C:67
inet addr:192.168.1.46 Bcast:255.255.255.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5467841 errors:0 dropped:0 overruns:0 frame:0
TX packets:5350581 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:558289926 (532.4 MiB) TX bytes:2801297720 (2.6 GiB)
Interrupt:16 Base address:0xe000

eth1 Link encap:Ethernet HWaddr 00:14:BF:5F:38:03
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3544366 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:3059236 dropped:0 overruns:0 carrier:6025255
collisions:0 txqueuelen:1000
RX bytes:3112526109 (2.8 GiB) TX bytes:0 (0.0 b)
Interrupt:20 Base address:0xa000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:325347 errors:0 dropped:0 overruns:0 frame:0
TX packets:325347 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:64463859 (61.4 MiB) TX bytes:64463859 (61.4 MiB)

[root@presario Sun Apr 06 20:59:04 ~]#Oops! missed that - you are root.

DeanRIowa
7th April 2008, 02:01 AM
I am logged in as root.

scottro
7th April 2008, 02:02 AM
Ohhh kay. http://home.nyc.rr.com/computertaijutsu/rhpath.html will explain this. It's a bit different.
/sbin/ifconfig will give you the IP address
netstat -r will give you the gateway.
To get the DNS servers

cat /etc/resolv.conf

Hingler wasn't saying you made a typo, he was just being slightly droll about the similarity of the command. Our Active Directory admin tends to type it by accident when checking a Unix box and I tend to type ifconfig by accident when checking a Windows box and we laugh at each other, but I tell him that as I'm old, I have the right to make mistakes while a young 'un like him shouldn't. :)

forkbomb
7th April 2008, 02:08 AM
I am logged in as root.
There's a difference between "su -" and "su". If you do the latter, you'll have to give absolute path (/sbin/ifconfig). Did you use su or su -?

DeanRIowa
7th April 2008, 02:14 AM
"su -" did it!

ok, what is the difference between "su" and "su -"?

I am coming from a Windows and Unix envirnoments.


thanks

Dean

scottro
7th April 2008, 02:25 AM
I know Windows admins and when they are given a link to something and told that it will explain the situation, they usually go and read it before asking another question. :)

As for ifconfig and route being deprecated, I missed this one. Where is it documented? Stevea, I'm not doubting you with that question, I'm just curious where does Fedora announce such relatively important things? Googling for ifconfig deprecated gives me, on the first page, only two hits related to a Fedora URL and they're both for these forums.

stevea
7th April 2008, 02:47 AM
There are a lot of references to this. The current net-tool package was last updated in 2001 !

http://www.linux-foundation.org/en/Net:Net-tools

I don't think the net-tools binaries will disappear anytime soon, but you should learn the new commands.

scottro
7th April 2008, 02:57 AM
Yes, I see that it's been around (according to the history section of the man page) since 2002. Looking at it, it does seem far more flexible, combining route and ifconfig in one command. Though as the options are pretty different for the two, I don't know if I could really say "one command".

forkbomb
7th April 2008, 06:35 PM
"su -" did it!

ok, what is the difference between "su" and "su -"?

I am coming from a Windows and Unix envirnoments.


thanks

Dean
"su" will give you root rights. "su -" will give you root rights and change your path to that of root (/sbin and /usr/sbin are part of root's path) allowing you to run sbin commands without full path. If you've ever modified the %PATH variables in Windows, it's the same idea (but less relevant in Windows because admin use is routine :rolleyes: ).

Pikine - Hachioji Photos on Instagram - Dehradun Travel Photos on Instagram -