LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-17-2006, 03:17 AM   #1
Groucho
Member
 
Registered: Sep 2003
Location: Milano, Italy
Distribution: Slackware
Posts: 56

Rep: Reputation: 15
Question Two network configurations


Hi.
I have a little question.
I've a laptop with slackware 10.2 on it.
At work I have a network configuration with DHCP.
In another office I have to set manually a static IP to connect the laptop to the LAN.
So the question is: it is possible to have two network configurations and switch between them in a simple way?
Now I've made to version of all files having network informations. All times I connect my laptop I have to rename some of those files and reboot.
Thanks a lot
 
Old 01-17-2006, 03:54 AM   #2
piete
Member
 
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465

Rep: Reputation: 44
I've recently been supporting a friends effort to get onto Linux, and she had a similar problem with her wireless network. Obviously she needs to store one setup for home and one setup for uni.

As far as I am aware, there is no "network profile" or equivalent in Slackware. At least, if there is, it's so obfuscated that you'd never think to try it

The solution I came up with for her was to mess with some of the /etc/rc.d scripts. I did the wireless equivalent of the following:

Code:
#################
# rc.inet1.conf #
#################

NETSWITCH = "home"

case "$NETSWITCH" in
home )
# Config information for eth0 @ home:
IPADDR[0]="192.168.0.69"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""
;;
work )
# Config information for eth0 @ work:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""
;;
esac
Once you've done it, you can rerun the network script with: /etc/rc.d/rc.inet1 eth0_restart

Or if you have more than one physical card:

Code:
~# /etc/rc.d/rc.inet1 stop
~# /etc/rc.d/rc.inet1 start
I haven't tested it very thoroughly, so, please please please backup any files before modification!! I will accept no responsibility for typos in your variable names

Good luck!
- Piete

Edit:

I forgot to mention, if you hadn't already worked it out, you can now flip between home/work by changing the variable NETSWITCH in your file and rerunning the script as above. Seems simple enough to me, but, I like to make sure there are no misunderstandings!

Last edited by piete; 01-17-2006 at 03:55 AM.
 
Old 01-17-2006, 04:28 AM   #3
Groucho
Member
 
Registered: Sep 2003
Location: Milano, Italy
Distribution: Slackware
Posts: 56

Original Poster
Rep: Reputation: 15
Thanks for your reply.
I'll try immediately.
Cheers
 
Old 01-17-2006, 06:48 AM   #4
cathectic
Member
 
Registered: Sep 2004
Location: UK, Europe
Distribution: Slackware64
Posts: 761

Rep: Reputation: 35
Another alternative which I use on my laptop is to replace /etc/rc.d/rc.inet1.conf with a symlink that points to another file (e.g. /etc/rc.d/rc.inet1.conf.home)

I then have another bash script called 'chnet' which takes the rc.inet1.conf extension (e.g. home), then switches the rc.inet1.conf symlink to the profile/ rc.inet1.conf.* I want to use and restarts rc.inet1

However, since I'm having trouble getting the network scripts to play nice with wpa_supplicant at the best of times, for now it's so-so (more useful for switching between wired networks for the moment).
 
  


Reply



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
Need different configurations with my Laptop rgbrock1 SUSE / openSUSE 5 11-08-2005 08:11 AM
nmap finding c++ compiler/ network configurations nanoprobe SUSE / openSUSE 2 04-07-2005 03:32 PM
Two network configurations, dial-up and static IP? sia Linux - Networking 1 05-24-2004 05:31 PM
Multiple network configurations at boot time. HOW? FairyFighter Linux - General 14 03-10-2004 05:04 AM
speakers and configurations ronss Linux - Software 5 09-21-2003 02:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:33 PM.

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