LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 11-15-2008, 11:12 AM   #1
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 617

Rep: Reputation: 33
Manually set ip-adres


In windows I find it very easy to manually set my ip-adres to be in a certain subnet (when I want to be in the same subnet of a router to configure it).

Question : how do I manually set my ip-adres in Fedora9 ? Do I do this by editing /etc/sysconfig/network-scripts/ifcfg-eth0 ??

I am always connected by a wireless connection to my home network 192.168.123.0. When I want to watch the settings of a router (not my own router but one that is connected via ethernet) I do the following :

[root@localhost jonas]# /sbin/ifconfig wlan0 down
[root@localhost jonas]# /sbin/ifconfig eth0 up
[root@localhost jonas]# /sbin/ifconfig eth0 192.168.1.2
[root@localhost jonas]# /sbin/ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:1B:24:A4:B6:06
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21b:24ff:fea4:b606/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:13663 (13.3 KiB)
Interrupt:17

[root@localhost jonas]# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.2 icmp_seq=2 Destination Host Unreachable
From 192.168.1.2 icmp_seq=3 Destination Host Unreachable
From 192.168.1.2 icmp_seq=4 Destination Host Unreachable
^C
--- 192.168.1.1 ping statistics ---
7 packets transmitted, 0 received, +3 errors, 100% packet loss, time 6468ms
pipe 3

You see that I cannot seem to reach the router (192.168.1.1) that is connected via my eth0-interface.
 
Old 11-15-2008, 11:44 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
route add default gw 192.168.1.1
 
Old 11-15-2008, 12:08 PM   #3
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 617

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by repo View Post
route add default gw 192.168.1.1
I do not want to set my default gateway cause this means that also my wireless connection will be messed up. And I do not need a default gateway, I do not need to communicate with the outside world...
I just want to manually change my ip-adres to one that I choose.
 
Old 11-15-2008, 12:16 PM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
Quote:
I do not want to set my default gateway cause this means that also my wireless connection will be messed up. And I do not need a default gateway, I do not need to communicate with the outside world...
I just want to manually change my ip-adres to one that I choose.
What is the current GW?
 
Old 11-15-2008, 12:33 PM   #5
pauledwards03
Member
 
Registered: Dec 2006
Distribution: Slackware 12.1
Posts: 94

Rep: Reputation: 15
If you don't need a default GW you don't need a network But if you just want to change your IP address do ifconfig eth0 (whatever interface name) xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx normally the default gw comes after this and you do need it, you could put the IP address of the switch/router that that particular interface is connected to.

I would do this to change my IP address

ifconfig eth0 10.151.35.45 netmask 255.25.240.0 10.151.32.245


I am not sure if you can just leave out the subnet mask and default gw...
 
Old 11-15-2008, 12:37 PM   #6
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 617

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by repo View Post
What is the current GW?
Why do you keep fixing on the default gateway ?
My default gateway (sweex) is 192.168.123.254 for my own home network.
What does the GW have to do with changing my ip-address manually ?
I'm not even on my network when I (try to) connect to the Philips router.

Suppose I want to set up a wireless network from scratch. Then I first need to communicate to the router via a wired interface. If the router has an web-interface that I can reach through 192.168.1.1 than I need to manually put myself in this 192.168.1 -network, right ?
So... does anyone know how to change my ip-adres manually ?

In windows I go to my interface > IPv4 properties > fill in the ip-address...
How does this go in Linux ?
 
Old 11-15-2008, 12:42 PM   #7
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 617

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by pauledwards03 View Post
If you don't need a default GW you don't need a network But if you just want to change your IP address do ifconfig eth0 (whatever interface name) xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx normally the default gw comes after this and you do need it, you could put the IP address of the switch/router that that particular interface is connected to.

I would do this to change my IP address

ifconfig eth0 10.151.35.45 netmask 255.25.240.0 10.151.32.245


I am not sure if you can just leave out the subnet mask and default gw...
I think that I'm not obliged to define the subnet mask and default gw because the system can guess the default subnet by looking at the ip-address to know that it is a class A,B or C address.
No gw means no access to the outside world, but that's not necessary.

If you look at my first post you'll see that I allready tried ifconfig eth0 xxx.xxx.xxx.xxx but it did not help in reaching a host on the same network that I'm in then.
 
Old 11-15-2008, 12:44 PM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
Quote:
In windows I go to my interface > IPv4 properties > fill in the ip-address...
and the netmask and the default GW
 
Old 11-15-2008, 12:54 PM   #9
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 617

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by repo View Post
and the netmask and the default GW
No, the subnet mask is filled in automatically according to the ip-address that is set. If you want to change the subnet mask, then you can do so.
The default gateway is not necessary, like I already said. I only use 1 internal network.
 
Old 11-15-2008, 12:58 PM   #10
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
Quote:
No, the subnet mask is filled in automatically according to the ip-address that is set. If you want to change the subnet mask, then you can do so.
The default gateway is not necessary, like I already said. I only use 1 internal network.
So, your ip is 192.168.1.2
netmask is 255.255.255.0
what is your gateway in this case?

cold you give us the output from
/sbin/route -n ?
 
Old 11-15-2008, 01:09 PM   #11
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
At work, years ago, we were installing new video equipment. I had to switch quickly between two networks, and created an ifcfg-eth0 file for each one, e.g. ifcfg-eth0.adtec & ifcfg-eth0.seachange. Then I created a script that simply copied the one I wanted over the old ifcfg-eth0 file and restarted the network service. In SuSE, the iwcfg-eth0 file is sourced by the ifup-eth0 script. On SuSE, the config file is in /etc/sysconfig/network/, but it may be in a different location on others. For slackware or debian, there may be an /etc/network file that configures networking directly with ifconfig and route commands.
 
Old 11-15-2008, 01:26 PM   #12
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 617

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by repo View Post
So, your ip is 192.168.1.2
netmask is 255.255.255.0
what is your gateway in this case?

cold you give us the output from
/sbin/route -n ?
I don't know what my gateway is. I don't need a gateway. I just want to communicate to a node in the subnet 192.168.1.0. I don't need a gateway 'cause I'm in the same subnet.
I want to access the router via the build-in webinterface that is accessible via the address 192.168.1.1.

What do you do in this setup ???

What I do : I put my pc in the same subnet namely 192.168.1 by manually giving myself the ipaddress 192.168.1.2 or 192.168.1.3 or whatever that's in the same subnet as the client that I want to reach.

When my pc has the ipaddress 192.168.1.2 and the node that I want to reach has the default fixed address 192.168.1.1 then I'm set to communicate.

Same principle as with an APIPA-address !

By editing the /etc/sysconfig/network-scripts/ifcfg-eth0 -file I have now access to the router :

[root@localhost jonas]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Broadcom Corporation NetLink BCM5787M Gigabit Ethernet PCI Express
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:1b:24:a4:b6:06
ONBOOT=no
IPADDR=192.168.1.2

Still I don't understand why this did not work in the very beginning...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Manually having to set essid reverse Debian 3 10-09-2007 06:30 AM
I'm Having Trouble Trying to Manually Set Cap_Sys_Nice Flag... paintballer1016 Linux - General 3 07-19-2007 07:53 AM
Howto set display to standby manually? JoSch1337 Linux - Software 2 05-16-2007 01:54 AM
Can I set the IRQ's for my devices manually? Galik Linux - Hardware 1 06-05-2004 05:43 AM
How to set up a proxy manually? posat Linux - Newbie 2 04-15-2004 12:20 PM


All times are GMT -5. The time now is 07:13 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration