DNS and multiple VPNs: Using dnsmasq to access multiple dns suffixes

On my Fedora 15 laptop, I'm almost always connected to several VPNs simultaneously. One VPN to my office or to my home (depending on where I am), one to the data center, one to a customer. These connections all have their own DNS server with their own suffix.

To make all dns suffixes working, I created a script that redirects all outgoing DNS traffic to dnsmasq running on localhost, which in turn forwards all requests for .lan to 192.168.15.254 and all requests for .gl to 192.168.1.254.

The script was put in /etc/NetworkManager/dispatcher.d/10-DNS:

if [ -e /var/run/dnsmasq.localhost ]; then
        cat /proc/`cat /var/run/dnsmasq.localhost`/cmdline |grep dnsmasq >/dev/null 2>/dev/null && \
        kill `cat /var/run/dnsmasq.localhost`
fi
 
if [ "$2" == "up" ]; then
        cp /etc/resolv.conf /etc/resolv.conf.dhcp
        echo nameserver 127.0.0.1 >  /etc/resolv.conf
        echo domain $DHCP4_DOMAIN_NAME >> /etc/resolv.conf 
        echo search $DHCP4_DOMAIN_NAME >> /etc/resolv.conf 
        /usr/sbin/dnsmasq -C /dev/null -r /etc/resolv.conf.dhcp --server=/gl/192.168.1.254 \
            --server=/lan/192.168.15.254 --bind-interfaces --listen-address 127.0.0.1 \ 
            --pid-file=/var/run/dnsmasq.localhost
fi

Once I had to fix resolv.conf manually when I connected my laptop to my Samsung Galaxy SII as well. This may mean I need to improve the script some day, but for the time being, it works good enough.

© GeekLabInfo DNS and multiple VPNs: Using dnsmasq to access multiple dns suffixes is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

SELinux: Running OpenVPN on a different port

To allow OpenVPN to run on a different port than 1194, you'll need to tweak your SELinux permissions:
/usr/sbin/semanage port -a -t openvpn_port_t -p udp 61616

© GeekLabInfo SELinux: Running OpenVPN on a different port is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Reconfigure nspluginwrapper

Yay, I just upgraded my nspluginwrapper and everything broke. Again. Couldn't use youtube or any of my other favorite sites anymore.

Running firefox from the console gave me some feedback:

*** NSPlugin Viewer  *** ERROR: NP_Initialize() get args: Message argument mismatch
*** NSPlugin Viewer  *** ERROR: rpc_end_sync called when not in sync!
*** NSPlugin Wrapper *** ERROR: NP_Initialize() wait for reply: Connection closed
NOTE: child process received `Goodbye', closing down

When I google'd around a bit, I found some commands for older/different versions of nspluginwrapper. Finally, I tried the parameters of the old binary on the new binary:
/usr/lib64/nspluginwrapper/npconfig -a -v -i
and got the output:

Auto-install plugins from /usr/lib/mozilla/plugins
Looking for plugins in /usr/lib/mozilla/plugins
Install plugin /usr/lib/mozilla/plugins/libflashplayer.so
  into /home/username/.mozilla/plugins/npwrapper.libflashplayer.so
Auto-install plugins from /usr/lib64/mozilla/plugins
Looking for plugins in /usr/lib64/mozilla/plugins
*** NSPlugin Viewer  *** ERROR: /usr/lib64/mozilla/plugins/libtotem-gmp-plugin.so: wrong ELF class: ELFCLASS64
Install plugin /usr/lib64/mozilla/plugins/libtotem-gmp-plugin.so
  into /home/username/.mozilla/plugins/npwrapper.libtotem-gmp-plugin.so
*** NSPlugin Viewer  *** ERROR: /usr/lib64/mozilla/plugins/skypebuttons.so: wrong ELF class: ELFCLASS64
Install plugin /usr/lib64/mozilla/plugins/skypebuttons.so
  into /home/username/.mozilla/plugins/npwrapper.skypebuttons.so
*** NSPlugin Viewer  *** ERROR: /usr/lib64/mozilla/plugins/libtotem-cone-plugin.so: wrong ELF class: ELFCLASS64
Install plugin /usr/lib64/mozilla/plugins/libtotem-cone-plugin.so
  into /home/username/.mozilla/plugins/npwrapper.libtotem-cone-plugin.so
*** NSPlugin Viewer  *** ERROR: /usr/lib64/mozilla/plugins/librhythmbox-itms-detection-plugin.so: wrong ELF class: ELFCLASS64
Install plugin /usr/lib64/mozilla/plugins/librhythmbox-itms-detection-plugin.so
  into /home/username/.mozilla/plugins/npwrapper.librhythmbox-itms-detection-plugin.so
*** NSPlugin Viewer  *** ERROR: /usr/lib64/mozilla/plugins/libtotem-narrowspace-plugin.so: wrong ELF class: ELFCLASS64
Install plugin /usr/lib64/mozilla/plugins/libtotem-narrowspace-plugin.so
  into /home/username/.mozilla/plugins/npwrapper.libtotem-narrowspace-plugin.so
*** NSPlugin Viewer  *** ERROR: /usr/lib64/mozilla/plugins/libtotem-mully-plugin.so: wrong ELF class: ELFCLASS64
Install plugin /usr/lib64/mozilla/plugins/libtotem-mully-plugin.so
  into /home/username/.mozilla/plugins/npwrapper.libtotem-mully-plugin.so
*** NSPlugin Viewer  *** ERROR: /usr/lib64/mozilla/plugins/libjavaplugin.so: wrong ELF class: ELFCLASS64
Install plugin /usr/lib64/mozilla/plugins/libjavaplugin.so
  into /home/username/.mozilla/plugins/npwrapper.libjavaplugin.so
Auto-install plugins from /home/username/.mozilla/plugins
Looking for plugins in /home/username/.mozilla/plugins
Install plugin /home/username/.mozilla/plugins/libflashplayer.so
  into /home/username/.mozilla/plugins/npwrapper.libflashplayer.so
*** NSPlugin Viewer  *** ERROR: /home/username/.mozilla/plugins/libnpgoogletalk64.so: wrong ELF class: ELFCLASS64
Install plugin /home/username/.mozilla/plugins/libnpgoogletalk64.so
  into /home/username/.mozilla/plugins/npwrapper.libnpgoogletalk64.so
*** NSPlugin Viewer  *** ERROR: /home/username/.mozilla/plugins/libnpgtpo3dautoplugin.so: wrong ELF class: ELFCLASS64
Install plugin /home/username/.mozilla/plugins/libnpgtpo3dautoplugin.so
  into /home/username/.mozilla/plugins/npwrapper.libnpgtpo3dautoplugin.so

After this, my Firefox was running as usual.

© GeekLabInfo Reconfigure nspluginwrapper is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Simple dual uplink configuration

Last week I switched from ADSL to EuroDOCSIS cable. I couldn't just shut down the DSL connection as several services were still connecting to that IP. So I made my home router (Fedora 15) kind of multihomed.

Configuration

I haven't even taken the time to seperate the ADSL and cable modems, I just hooked them up to the same network interface. Of course, they got their own IP range.

ADSL modem: 192.168.2.254/24
Cable modem: 192.168.1.1/24

Step 1: Add ip
ip addr add 192.168.1.2 dev eth0

Step 2: Routing
By default we send all outgoing packages to the default gateway at 192.168.2.254. Only packets that are answers to incoming packets on the 192.168.1.x network must be routed back to 192.168.1.1
ip rule add from 192.168.1.0/24 lookup 1001
ip route add default gw 192.168.1.1 table 1001

That's all. Of course, above setup only takes care of answering to incoming packets. If you want to load-balance or have a fail-over setup, I suggest you read the Linux Advanced Routing & Traffic Control HOWTO.

© GeekLabInfo Simple dual uplink configuration is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Viewing a V4L2 webcam with mplayer

The great mplayer can be used to view movies, play dvd's, and even to watch the webcam. For my Logitech QuickCam Pro 4000, I use the following command:
mplayer -cache 128 -tv driver=v4l2:width=640:height=480:outfmt=i420 -vc rawi420 -vo xv tv://

If you have multiple v4l2 devices, you can choose which device you want to use by adding 'device=/dev/videoX' to the options:
mplayer -cache 128 -tv driver=v4l:width=640:height=480:outfmt=i420:device=/dev/video1 -vc rawi420 -vo xv tv://

© GeekLabInfo Viewing a V4L2 webcam with mplayer is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 2.50 out of 5)
Loading...

SELinux: Running samba unconfined

I don't want to disable SELinux, but i'm using samba to access about every file on the system. To run samba unconfined, change its context:
chcon -t unconfined_exec_t /usr/sbin/smbd
service smb restart

This works for other software as well.

Update: Another solution may be to run software in permissive mode. I just changed the mode of one postfix sub-program to permissive mode: semanage permissive -a postfix_pipe_t

© GeekLabInfo SELinux: Running samba unconfined is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

Fedora 15: Nagios errors

Installation of Nagios on Fedora 15 is easy as yum install nagios nagios-plugins* php nrpe. I only found one problem: Error: Could not read object configuration data!

The webserver runs as user apache, which cannot access /etc/nagios/objects by default. Chmod or chown the directory to fix it, or add user apache to the group nagios.

You may also want to check the selinux settings, which can be restored by typing restorecon /etc/nagios

© GeekLabInfo Fedora 15: Nagios errors is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 5.00 out of 5)
Loading...