LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-15-2012, 08:46 AM   #1
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Rep: Reputation: 22
Script on NIC Up - Doesn't Work


Does anyone know why execution of a script when a network interface comes up, doesn't work?

I have this in /etc/network/if-up.d
Code:
#!/bin/sh

# Don't run sshcygnus while bringing up the loopback or eth0 device;
# it's not necessary until we bring up wlan0
[ "$IFACE" = "lo" ] || exit 0
[ "$IFACE" = "eth0" ] || exit 0
echo "sshcygnus0" >/var/log/messages

if [ -x /usr/local/bin/sshcygnus ] ; then
echo "sshcygnus1" >/var/log/messages
  exec /usr/local/bin/sshcygnus
echo "sshcygnus2" >/var/log/messages

fi
 
Old 01-15-2012, 12:36 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
What distro are you using? I use Fedora 15, and this is how my system is setup:
Code:
[root@ltp01 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@ltp01 network-scripts]# ls -a
.                     ifcfg-em1              ifdown       ifdown-ipsec  ifdown-ppp     ifup          ifup-ippp   ifup-isdn   ifup-ppp     ifup-wireless        keys-wrt350nmodv101a
..                    ifcfg-lo               ifdown-bnep  ifdown-ipv6   ifdown-routes  ifup-aliases  ifup-ipsec  ifup-plip   ifup-routes  init.ipv6-global     net.hotplug
ifcfg-DJRcomputing    ifcfg-wlan0            ifdown-eth   ifdown-isdn   ifdown-sit     ifup-bnep     ifup-ipv6   ifup-plusb  ifup-sit     keys-DJRcomputing    network-functions
ifcfg-donna-wireless  ifcfg-wrt350nmodv101a  ifdown-ippp  ifdown-post   ifdown-tunnel  ifup-eth      ifup-ipx    ifup-post   ifup-tunnel  keys-donna-wireless  network-functions-ipv6
[root@ltp01 network-scripts]#
 
Old 01-19-2012, 10:23 AM   #3
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
Using Debian. Unfortunately Fedora is quite different.

After more testing, it appears that these two lines are at fault:
[ "$IFACE" = "lo" ] || exit 0
[ "$IFACE" = "eth0" ] || exit 0

When I comment them out, the script then runs.

It doesn't make sense, as the script is run for each interface. When I shut down wlan0 and bring it back up, lo and eth0 are not being brought up. wlan0 should be the interface in $IFACE.

Also, when running it tries to set up reverse tunnels for IPP (port 631) but fails with 'no route to host'. Only subsequent tunnels show the normal setup, including MythTV, Squid, and MySQL. I guess this is because of the delay in association of the wlan interface with the router, although I put a wait 3 at the beginning of the tunnel script and it didn't help. So it's a mystery...

Last edited by Quantumstate; 01-19-2012 at 12:16 PM.
 
  


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
NIC doesn't save settings. Debian 5.0 used to work until update joebpa Debian 1 07-07-2009 07:49 AM
new NIC doesn't work in Linux FC3? trien27 Linux - Networking 1 07-30-2007 12:37 AM
My NIC doesn't seem to work... kenneth_phough Linux - Laptop and Netbook 1 06-18-2006 08:32 PM
FC2 - NIC doesn't work - slows down my pc benjin Linux - Networking 4 08-13-2004 06:16 PM
PCMCIA NIC doesn't work any more X11 Linux - Hardware 1 07-21-2002 05:20 AM

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

All times are GMT -5. The time now is 04:31 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