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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-15-2008, 11:12 AM
|
#1
|
|
Member
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 574
Rep:
|
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.
|
|
|
|
11-15-2008, 11:44 AM
|
#2
|
|
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464
|
route add default gw 192.168.1.1
|
|
|
|
11-15-2008, 12:08 PM
|
#3
|
|
Member
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 574
Original Poster
Rep:
|
Quote:
Originally Posted by repo
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.
|
|
|
|
11-15-2008, 12:16 PM
|
#4
|
|
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464
|
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?
|
|
|
|
11-15-2008, 12:33 PM
|
#5
|
|
Member
Registered: Dec 2006
Distribution: Slackware 12.1
Posts: 94
Rep:
|
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...
|
|
|
|
11-15-2008, 12:37 PM
|
#6
|
|
Member
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 574
Original Poster
Rep:
|
Quote:
Originally Posted by repo
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 ?
|
|
|
|
11-15-2008, 12:42 PM
|
#7
|
|
Member
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 574
Original Poster
Rep:
|
Quote:
Originally Posted by pauledwards03
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.
|
|
|
|
11-15-2008, 12:44 PM
|
#8
|
|
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464
|
Quote:
|
In windows I go to my interface > IPv4 properties > fill in the ip-address...
|
and the netmask and the default GW
|
|
|
|
11-15-2008, 12:54 PM
|
#9
|
|
Member
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 574
Original Poster
Rep:
|
Quote:
Originally Posted by repo
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.
|
|
|
|
11-15-2008, 12:58 PM
|
#10
|
|
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464
|
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 ?
|
|
|
|
11-15-2008, 01:09 PM
|
#11
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
|
11-15-2008, 01:26 PM
|
#12
|
|
Member
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 574
Original Poster
Rep:
|
Quote:
Originally Posted by repo
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...
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:35 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|