Re: [gentoo-user] iptables: how can I include multiple hosts/IPs in -s and -d?

2010-04-09 Thread Stefan Schulte
Hi,


you can define a rule like that:

iptables -A FORWARD -s 192.168.235.43,192.168.235.46 -d
10.0.0.1,192.168.0.1 -j ACCEPT

it will create 4 rules.

be sure to activate Networking support-Networking options-Network
packet filtering framework-Core Netfilter Configuration-iprange
address range match support

Now you can do something like

iptables -A FORWARD -m iprange --src-range '10.0.0.1-10.0.0.44' -j
ACCEPT

hope it helps

-Stefan

On Mon, Apr 05, 2010 at 07:32:17PM +0200, Jarry wrote:
 Hi
 
 I'd like to ask if there is some way to include multiple discrete
 hosts/IP's in --source and --destination options of iptables.
 
 I'm trying to write firewall rules for my server, but it has
 12 IP's from different segments (and maybe it gets a few more
 later), and the script grows up as I have to write nearly
 identical rules with difference only in -s/-d IP's.
 
 What I'm looking for is a way to define some variable at the
 beginning of my script, like MY_IP=IP1 IP2 IP3 IP4... and
 later to use is in rules (iptables -A INPUT -s $MY_IP...).
 But I do not know how to use it. As far as I understand it,
 --source/--destination accepts only single IP's or continuous
 IP-segments...
 
 Jarry
 
 -- 
 ___
 This mailbox accepts e-mails only from selected mailing-lists!
 Everything else is considered to be spam and therefore deleted.
 


pgp8CBCXDQtso.pgp
Description: PGP signature


[gentoo-user] Setting up WLAN and VPN the right way

2010-03-18 Thread Stefan Schulte
Hi at all,

I'm trying to setup VPN on my Laptop but I'm stuck. When I'm at the
university I have to connect to their WLAN and then setting up a
VPN-Connection. All packets should take the VPN-tunnel. Here's what I've
got so far:

1) W-LAN connection works and I get an ip, default route and DNS-Servers
via dhcp

- eth1 is my WLAN-Device
- ppp0 is my VPN-Device
- vpn.bg.bib.de is the disired VPN-Server
snippet of /etc/conf.d/net:

modules=iproute2
modules_eth1=!iwconfig wpa_supplicant
wpa_supplicant_eth1=-Dwext
dhcp_eth1=nosendhost nonis nontp
config_eth1=dhcp

pppd_ppp0=
defaultroute
noauth
persist
call fhdw
holdoff 10
mru 1460
mtu 1460
idle 600
link_ppp0=pty 'pptp vpn.bg.bib.de --nolaunchpppd'

2) VPN Connection does work
- pptpclient is installed
- /etc/ppp/peers/fhdw with options usepeerdns and defaultroute
- »/etc/init.d/net.ppp0 start« does start the vpn connection

BUT:
1)
After the tunnel is up, /etc/ppp/ip-up.d/40-dns.sh is supposed to
replace the dhcp-nameservers with dns-servers behind the VPN-server
stored in /etc/ppp/resolv.conf. Unfortunately
the resolv.conf is immediatly altered a second time by baselayout or
whatever is writing these »Generated by net-scripts for interface«
lines and then I've no nameserver at all. I have to do a
cat /etc/ppp/resolv.conf  /etc/resolv.conf
every time after the tunnel is up.

2)
After the tunnel is up I have two default routes. One for eth1 and one
for ppp0. So I manually set up a hostroute for the vpn-server with the
eth1 gateway and then delete the default route for eth1. After that the
VPN-Server is reached through eth1 and all the rest through ppp0
Unfortunately the default route for eth1 appears again after a few
minutes (I guess dhcpcd is to blame) and every connection breaks down
until I delete the route again.

So how do you set up a VPN correctly? Or is there is any documentation
I've missed?

BTW: I'm using fluxbox and no networkmanager or stuff like that.

-Stefan


pgpndtXy86zg8.pgp
Description: PGP signature


Re: [gentoo-user] Resizing ntfs creates a hidden partition

2010-02-20 Thread Stefan Schulte
Hi Mick,

AFAIK the asterisk behind the partition just indicates, that it is not
aligned to a cylinder boundary. I think this doesnt have any effect (or
maybe some old OS like DOS depend on it). If you use cfdisk for
partitioning you can avoid that by given the space in c(ylinders). e.g.
New Partition with a size of '100c'.

I guess your hidden partition has something to do with Windows
behaviour, because if you install Windows and create partitions during
the installation process, it also creates an extra 8MB partition.
Maybe gparted adopted that behaviour.

But I can't tell you the reason why. Some people say it's for temp data
(which I doubt) and others say it's used to store metadatas if the user
decides to use flexible disks or software RAIDs. 

I just can say that windows is running fine without it on my computer,
because i decided to partition with cfdisk before running the
installation.

On Sat, Feb 20, 2010 at 11:23:27AM +, Mick wrote:
 Hi All,
 
 I am resizing a Windows partition to get some space for Gentoo.  I
 noticed that when gparted finished and I rebooted the machine there is
 a blank unallocated space in front of the Windows 7 partition, shown
 below as 6.33MB:
 
 ===
  cfdisk (util-linux-ng 2.16.1)
 
   Disk Drive: /dev/sda
Size: 500107862016 bytes, 500.1 GB
  Heads: 255   Sectors per Track: 63   Cylinders: 60801
 
 NameFlags  Part Type  FS Type  [Label]Size 
 (MB)
  
 --
 sda1Primary   Dell Utility
 41.13
 sda2BootPrimary   NTFS []  
 15728.64*
 Pri/Log   Free Space   
 6.33*
 sda3Primary   NTFS []  
 52426.47*
 Pri/Log   Free Space  
 431902.70*
 
 ===
 
 Also, when I used gparted to create a new extended partition over the
 431G free space at the end of the disk I ended up with a similar small
 unallocated space in front of it.  This is something I have observed
 happening recently on 3 laptops that I have worked on, i.e. resizing
 or creating a new partition inevitably creates a small blank partition
 in front of it.
 
 Looking at the sectors table I see this:
 ===
 Partition Table for /dev/sda
 
First   Last
  # Type   Sector  Sector   OffsetLength   Filesystem Type (ID) 
 Flag
 -- --- --- --- -- ---  
 
  1 Primary   0   80324 63   80325 Dell Utility (DE)
 None
  2 Primary   8032530800324* 03072*HPFS/NTFS (07)   
 Boot
Pri/Log30800325*   30812669  0   12345*Free Space   
 None
  3 Primary30812670   133208104* 0   102395435*HPFS/NTFS (07)   
 None
Pri/Log   133208105*  976768064  0   843559960*Free Space   
 None
 ===
 
 I am not sure what the asterisks are for after the last sector on the
 second and third partitions.
 
 Could this empty space jump be related to gparted somehow shifting the
 start of a partition to make it align with a particular sector as per
 previous thread on the 4k sector topic?
 
 Should I do anything about it, or just run with it and let gparted
 align what it wants to align as part of the partitioning process?
 -- 
 Regards,
 Mick
 


pgpyIm3oRAjEu.pgp
Description: PGP signature


Re: [gentoo-user] binutils broken revdep-rebuild

2010-02-04 Thread Stefan Schulte
On Thu, Feb 04, 2010 at 09:58:42AM +0100, Mariusz Ceier wrote:
 W dniu 04.02.2010 08:15, Steven pisze:
  I am having a recurring error for the last few weeks
  
  revdep-rebuild -p
  
  * Configuring search environment for revdep-rebuild
  
  * Checking reverse dependencies
  * Packages containing binaries and libraries broken by a package
  * update
  * will be emerged.
  
  * Collecting system binaries and libraries
  * Generated new 1_files.rr
  * Collecting complete LD_LIBRARY_PATH
  * Generated new 2_ldpath.rr
  * Checking dynamic linking consistency
  [ 37% ]  *   broken
  /usr/lib64/binutils/x86_64-pc-linux-gnu/2.20/libbfd.la (requires
  -liberty)
  *   broken
  *   /usr/lib64/binutils/x86_64-pc-linux-gnu/2.20/libopcodes.la
  *   (requires -liberty)
  [ 100% ] 
  * Generated new 3_broken.rr
  * Assigning files to packages
  *   /usr/lib64/binutils/x86_64-pc-linux-gnu/2.20/libbfd.la
  *   - sys-devel/binutils
  *   /usr/lib64/binutils/x86_64-pc-linux-gnu/2.20/libopcodes.la
  *   - sys-devel/binutils
  * Generated new 4_raw.rr and 4_owners.rr
  * Cleaning list of packages to rebuild
  * Generated new 4_pkgs.rr
  * Assigning packages to ebuilds
  * Generated new 4_ebuilds.rr
  * Evaluating package order
  * Generated new 5_order.rr
  * All prepared. Starting rebuild
  
  emerge --oneshot --pretend  sys-devel/binutils:0
  
  I am not to sure how to go about trouble shooting this problem.
  Everything seems to be running as usual aside from the revdep-rebuild
  broken error.
 Check if you have /etc/ld.so.conf.d/05binutils and not
 /etc/env.d/00glibc ( this file should contain LDPATH=include
 ld.so.conf.d/*.conf ), if so - rebuild glibc. If this is not the case,
 maybe try lafilefixer --justfixit.
 
 HTH
 

I have the same problem and I think the problem is revdep-rebuild.
binutils is just working fine and revdep-rebuild just thinks that it is
broken, because it doesnt check the right librarypath
(/usr/x86_64-pc-linux-gnu/lib). I tried your suggestion (rebuild glibc)
and it doesnt work. But I noticed something interesting:

cat /etc/ld.so.conf.d/05binutils.conf 
/usr/x86_64-pc-linux-gnu/lib

cat /etc/ld.so.conf
/usr/local/lib
include ld.so.conf.d/*.conf
[...]

I think this is normal. But when I start revdep-rebuild -v I get

revdep-rebuild environment:
SEARCH_DIRS=/bin
include
ld.so.conf.d/*.conf
/lib
/lib64
/opt/bin
[...]

So I guess the include-Statement should load the files under
ld.so.conf.d but it looks like its interpreted as a normal path

-Stefan


pgp0DjgAuBPun.pgp
Description: PGP signature


Re: [gentoo-user] How can I find all hard-links and soft-links?

2010-02-03 Thread Stefan Schulte
Hi Jarry,

searching for softlinks is pretty easy:

find / -type l

If my understanding of hardlinks is correct you cannot say which file is
the original and which file is the link. Both inodes just point to the
same datablocks. But you can identify those files by checking the
linkcount.

find / -type f -links '+1'

-Stefan

On Wed, Feb 03, 2010 at 07:37:36PM +0100, Jarry wrote:
 Hi,
 
 just out of curiosity: is there any quick way to find all
 hard- and soft-links on a system? I just want to be sure
 they were all created after I moved system from the old disk
 to the new one...
 
 Jarry
 -- 
 ___
 This mailbox accepts e-mails only from selected mailing-lists!
 Everything else is considered to be spam and therefore deleted.
 


pgpjolqEkBy2P.pgp
Description: PGP signature


Re: [gentoo-user] How can I find all hard-links and soft-links?

2010-02-03 Thread Stefan Schulte
Yeah, you're right. And I think I have to correct myself. You don't have
two inodes, you have two directoryentries pointing to the same inode. So
if you want to find corresponding files, you can sort by inodenumber:

find /usr/bin -type f -links '+1' -print0 | xargs -0 ls -li | sort -n

On Wed, Feb 03, 2010 at 10:02:37PM +0200, Alan McKinnon wrote:
 On Wednesday 03 February 2010 21:43:31 Stefan Schulte wrote:
  Hi Jarry,
  
  searching for softlinks is pretty easy:
  
  find / -type l
  
  If my understanding of hardlinks is correct you cannot say which file is
  the original and which file is the link.
 
 It's worse than that - the concept of original and the link simply does 
 not exist at all.
 
 Like invisible pink unicorns; you can't say you can't see them so you can't 
 say if it's there or not. The truth is There are no invisible pink unicorns
 
  Both inodes just point to the
  same datablocks. But you can identify those files by checking the
  linkcount.
  
  find / -type f -links '+1'
  
  -Stefan
  
  On Wed, Feb 03, 2010 at 07:37:36PM +0100, Jarry wrote:
   Hi,
  
   just out of curiosity: is there any quick way to find all
   hard- and soft-links on a system? I just want to be sure
   they were all created after I moved system from the old disk
   to the new one...
  
   Jarry
  
 
 -- 
 alan dot mckinnon at gmail dot com
 


pgptp35soYo6Z.pgp
Description: PGP signature


Re: [gentoo-user] /dev full of pty* tty* - is it normal?

2010-01-26 Thread Stefan Schulte
Looks different on my machine:

# ls -l /dev/pty* | wc -l
zsh: no matches found: /dev/pty*
0
# ls -l /dev/tty* | wc -l
65

It may have something to do with your kernel settings.
Device Drivers-Character devices-Unix98 PTY support is enabled
Device Drivers-Character devices-Legacy (BSD) PTY support is disabled
here

-Stefan

On Tue, Jan 26, 2010 at 06:57:33PM +0100, Alex Schuster wrote:
 Jarry writes:
 
  I just noticed I have *a lot of* tty/pty files in dev:
  
  obelix ~ # ls -l /dev/pty* | wc -l
  256
  obelix ~ # ls -l /dev/tty* | wc -l
  325
  
  They have names from /dev/ptya0 till /dev/ptyzf, then
  pty0-pty63, and ttya0-ttyzf. Is this normal? I thought
  udev creates device-files as they are needed, so I'm
  surprised to see so much of them...
 
 Seems to be normal, I get the same output on two of my Gentoo machines.
 
   Wonko
 


pgpCEg6oTcCJ1.pgp
Description: PGP signature


Re: [gentoo-user] Installation (or not) of Perl Getopt::Long

2009-12-26 Thread Stefan Schulte
Hi Stroller,

you may also want to look at Getopt::Declare. If you dont want to do
something fancy you just have to write the »program -help« page and
you're done.

It's not in portage but you can emerge g-cpan to install it.

Stefan

On Fri, Dec 25, 2009 at 04:21:53PM +, Stroller wrote:
 Hey, Gentoo,
 
 I'm just attempting to learn a little Perl and write a little Perl program.
 
 I have been experimenting with the Getopt::Long module, which seems to be 
 working fine, but I'm considering Getopt::Tabular instead.
 
 So I thought I'd search portage for Getopt, to see if that is readily 
 provided by Portage, or otherwise which modules are:
 
 $ eix -c -C perl Getopt 
 [N] dev-perl/Getopt-ArgvFile (1.11): This module is a simple supplement to 
 other option handling modules.
 [N] dev-perl/Getopt-Long-Descriptive (~0.083): Getopt::Long with usage text
 [N] dev-perl/Getopt-Mixed (1.10): Getopt::Mixed is used for parsing mixed 
 options
 [N] dev-perl/MooseX-Getopt (~0.26): A Moose role for processing command line 
 options
 [N] perl-core/Getopt-Long (2.38): Advanced handling of command line options
 Found 5 matches.
 $ 
 
 Yet none of them, not even the Get::Long package that I've been experimenting 
 with, are installed on my system:
 
 $ eix -c -C perl Getopt -I
 No matches found.
 $ 
 
 Can anyone explain, please, why this appears not to be installed? Yet how 
 it's working just fine?
 
 It looks like a simpler options parsing module is installed, but not this one:
 
 $ locate GetOpt
 /usr/share/man/man3/Tcl_ChannelGetOptionProc.3.bz2
 /usr/share/doc/perl-5.8.8-r8/html/lib/Pod/Perldoc/GetOptsOO.html
 /usr/lib/perl5/5.8.8/Pod/Perldoc/GetOptsOO.pm
 $ 
 
 Further evidence that Getopt::Long seems to be working on this system is that 
 it's used by get_iplayer, which has been working well on this system for the 
 last 3 weeks or so:
 
 $ grep -i Getopt  `which get_iplayer`
 use Getopt::Long;
 search  = [ 1, search=s, 'Search', '--search search 
 term', GetOpt compliant way of specifying search args],
 use Getopt::Long;
 # Build hash for passing to GetOptions module
 Getopt::Long::Configure(bundling);
 Getopt::Long::Configure(pass_through);
 Getopt::Long::Configure(no_pass_through);
 return GetOptions(%get_opts);
 $ 
 
 get_iplayer can be examined at http://linuxcentre.net/get_iplayer/get_iplayer 
 in case I'm misunderstanding its usage.
 
 I feel really dumb - there must be something simple  logical that I'm 
 missing here.
 
 Stroller.
 
 


pgpfStQycTknh.pgp
Description: PGP signature