Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Configuration:
Laptop with KUbuntu 6.10 running on it.
Problem:
I have a laptop with SSHD running on it. The situation is that SSHD server is only used at home and should be turned off whenever I am connected to network at work/office (security restrictions out there). So, I need somehow to let my laptop start SSHD server only whenever I am at home and connected to home network of course administrated by myself.
Solution:
One possible solution of given problem is to put simple BASH script in /etc/init.d/start_ssh.sh that would start SSHD server or not depending on currently connected NETWORK name. The only problem here is how to get that NETWORK name in BASH (Python/C++/(T)CSH)? Any Ideas?
P.S. I have found some interesting folders in /etc/network/ with names:
if-down.d
if-post-down.d
if-pre-up.d
if-up.d
Maybe as a solution start_ssh.sh script should be put there which will be executed each time network is changed? What is their purpose?
Do you get a different address when you are at work? ifconfig eth0 | grep inet will tell you your network address.
Then you could write some bash / sed / awk / python / whatever to decide whether to start sshd or not.
Do you get a different address when you are at work? ifconfig eth0 | grep inet will tell you your network address.
Then you could write some bash / sed / awk / python / whatever to decide whether to start sshd or not.
The solution is simple as usual. iwconfig will give me Access Point which is unique and can be used in order to get idea where am I working at: Home or Office.
The only problem is how to get the same information for wired connections? Sometimes I am using my cable network card. Any ideas?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.