LinuxQuestions.org
Visit Jeremy's Blog.
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, 06:20 PM   #1
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 247

Rep: Reputation: 19
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, 10:42 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 17,195

Rep: Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562
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 10:45 PM.
 
Old 11-13-2017, 11:51 PM   #3
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,108
Blog Entries: 3

Rep: Reputation: 179Reputation: 179
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, 09:34 AM   #4
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 247

Original Poster
Rep: Reputation: 19
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, 05:22 PM   #5
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,108
Blog Entries: 3

Rep: Reputation: 179Reputation: 179
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, 09:39 AM   #6
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 247

Original Poster
Rep: Reputation: 19
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


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



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 03:17 PM
[SOLVED] configuring a router where ethernet and wifi share a subnet twoprop Linux - Networking 3 05-18-2014 08:34 PM
Changing IP Address For Ethernet Computer on Router Network OtagoHarbour Ubuntu 20 11-10-2011 09:06 PM
[SOLVED] Configuring LT to use specific router address Sir Prised Linux - Laptop and Netbook 3 05-30-2011 08:37 AM
Changing Subnet on Linksys Router RemusX2 Linux - Networking 1 09-08-2005 10:19 PM

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

All times are GMT -5. The time now is 01:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration