LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-13-2017, 05:20 PM   #1
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Rep: Reputation: 28
Changing subnet IP address when configuring router: Slackware-14.2/x86_64


I'm not a network engineer but have run linux for many years; Slackware since 2003. It's not often that I need to configure a new router, but now I do, and sometimes changing the IP address of the laptop host to match the default router IP subnet (192.168.1.0/24) fails to work; that is the IP address is in that subnet but I cannot ping the router (192.168.1.1) nor open a browser tab to that address. I want to learn why it sometimes fails.

I know that ifconfig will bring the interface (eth0) up or down, but not change the IP address associated with it even though 'man ifconfig' suggests that ifconfig eth0 192.168.1.4 should work. Sometimes it does, most of the time it does not work.

I edit /etc/rc.d/rc.inet1.conf changing the IP address of eth0, then reboot the system. Usually, I need to follow that by manually running /etc/rc.d/rc.inet1 start, and sometimes also /etc/rc.d/rc.inetd start.

Even when ifconfig eth0 shows the correct ipv4 address and the interface is UP and RUNNING, I cannot ping from the laptop (192.168.1.4) to the router (192.168.1.1). I need to learn why so I can more quickly correct any connection problems in the future. Better yet, avoid them.

TIA,

Rich
 
Old 11-13-2017, 09:42 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
I think this is what you are asking.

I used to have to configure some ip to serial boxes that came out of the subnet. Wasn't worth it to reboot windows so I'd just make a static arp entry in the subnet range and config the box to the correct ip in it's web page. Then remove static arp entry. Pretty simple if you don't forget the entry.

Ping is a rather poor test usually. Since you seem to suggest that your configurations are correct then maybe you need to look at (again) arp entries. They don't last long but things like browser cache and maybe some other things could remain there for a bit.

Last edited by jefro; 11-13-2017 at 09:45 PM.
 
Old 11-13-2017, 10:51 PM   #3
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
This is a laptop does DHCP work?

Sounds like you don't have the correct mask set have you verified this with
Code:
ifconfig
or
ip a
If that all checks out then you could look if the machine can ping itself.

As to ifconfig it will configure the interface temporary, until next boot, as long as you give it everything it needs.
Code:
ifconfig eth0 192.168.1.4 netmask 255.255.255.0 broadcast 192.168.1.255
 
Old 11-14-2017, 08:34 AM   #4
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Original Poster
Rep: Reputation: 28
Responding to both Jefro and Lazydog by suggesting that I did not word my question as well as I could.

When I looked at the route on the laptop I discovered there was no default gateway route. That's most likely why the network was unreachable. I'll re-phrase my question this way:
Is there a defined series of steps to change a laptop's IP address and networking configuration to the default router subnet of 192.168.1.0/24? And one hat can easily be rolled back to the LAN's subnet once the router's WAN and LAN ports and firewall rules have been configured?
 
Old 11-14-2017, 04:22 PM   #5
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
If I'm understanding you correctly you want to take a laptop, I'm going to aSSUME IT IS USING hdcp, to another network and use it there and when you are finished take it back to the original network. If both networks have a DHCP server then you shouldn't have to do anything except restart the interface which should automatically get the right ip/gateway information.

If the second network doesn't have a DHCP server then you can configure this interface by hand as follows:

Using ifconfig then you need to tell it everything i.e.,
Code:
ifconfig eth0 192.168.1.4 netmask 255.255.255.0 broadcast 192.168.1.255
route add default gw 192.168.1.1 eth0
ifconfig sets up the interface
route adds the default route

Once finished you can remove the GW with;
Code:
route del default gw 192.168.1.1 eth0
Once you are off the static network (192.168.1.0/24) you just need to restart the interface to get a DHCP address again.
 
Old 11-15-2017, 08:39 AM   #6
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Original Poster
Rep: Reputation: 28
Resolved this issue by setting eth0 to use DHCP rather than a static IP address. Once the router was configured I changed the laptop's eth0 back to a static IP address.

Thanks for all your comments,

Rich
 
  


Reply

Tags
eth0, ip address, router configuration, subnet



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setup of route to subnet without changing the router vernuenftig Linux - Networking 7 08-14-2017 02:17 PM
[SOLVED] configuring a router where ethernet and wifi share a subnet twoprop Linux - Networking 3 05-18-2014 07:34 PM
Changing IP Address For Ethernet Computer on Router Network OtagoHarbour Ubuntu 20 11-10-2011 08:06 PM
[SOLVED] Configuring LT to use specific router address Sir Prised Linux - Laptop and Netbook 3 05-30-2011 07:37 AM
Changing Subnet on Linksys Router RemusX2 Linux - Networking 1 09-08-2005 09:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:32 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration