Latest Entries

automatic login to Cisco routers / firewalls

Since many of you are still connecting to your Cisco boxes with the plain ssh/telnet command (typing password every time) and since Cisco boxes don’t have SSH public key authentication, the tool to use comes from Rancid (Really Awesome New Cisco confIg Differ) package.

It’s called “clogin” as Cisco login script.

It requires all the credentials in ~/.cloginrc file (protocol / password / enable).

Syntax of .cloginrc file can be found here.

and usage is simple, just clogin hostname

And besides loging it’s very usefull for multiple box configuration. Let’s say you just need to write configs of your 5 routers.

clogin -c "write;exit" router1 router2 router3 router4 router5

and Voila !

S.

Mikrotik simple bandwidth control

There’s a really easy way of controlling bandwidth of an interface (e.g. guest interface).

It’s done via queues:
/queue simple add interface=guest max-limit=2M/2M disabled=no

Where “guest” is the interface name and 2M is the down/uplink speed in bps you want to shape it to.

More about this on Mikrotik Wiki

S.

HP-UX ssh X11 forwarding not working for certain applications

I had a strange issue with hp-ux x11 forwarding over ssh. xclock, xterm ran fine but hpterm and some other x11 programs didn’t start, claiming error:

X11 connection rejected because of wrong authentication.

after some searching I found following fixed the issue:

/opt/ssh/etc/sshd_config:
X11UseLocalhost no
(must be set to no, default is yes)

S.

Cisco ASA failover fail if IPv6 enabled

I can’t believe it…

Failover on Cisco ASA silently stops working after you enable ipv6 configuration.

We’re used of stupid Cisco bugs, but this wins it all !

S.

IPv6 over IPv4 tunnel with Mikrotik & Cisco router

Time when native IPv6 network will come right to your home is still far away. So tunneling IPv6 network over IPv4 to some IPv6 enabled site is a way to go.

Configuration is easier than expected and it worked right away. In my case Cisco 7600 series is at the data center where native IPv6 is established and Mikrotik RB450 ( a choice for home router – really powerful and really cheap).

One /64 subnet is assigned for the tunnel (point-to-point) and /48 is then routed to it. Yes. In IPv6 /64 subnet of 18446744073709551616 IPs is used for point-to-point tunnel (2 IPs).

On Cisco 7600 – interface (99.. is a 7600 public IP as 22.. is my home public IP):
interface Tunnel0
description --- test ipv6 in ipv4 tunnel ---
no ip address
ipv6 address 2AAA:BABA:101:1::1/64
tunnel source 99.99.99.99
tunnel destination 22.22.22.22
tunnel mode ipv6ip

and route:
ipv6 route 2AAA:BABA:BEEF::/48 2AAA:BABA:101:1::2

and on Mikrotik:
/interface 6to4 add disabled=no local-address=22.22.22.22 mtu=1280 name=ipv6tunnel remote-address=99.99.99.99
/ipv6 address add address=2AAA:BABA:101:1::2/64 interface=ipv6tunnel
/ipv6 route add disabled=no dst-address=::/0 gateway=ipv6tunnel

And that’s it. You can configure local interface on Mikrotik, like this:
/ipv6 add address=2AAA:BABA:BEEF:DEAD:1/64 advertise=yes interface=ether2

Local machines, if properly configured should receive advertised IPv6 prefix and configure itself for IPv6.

That’s for now, more about IPv6 soon ! HaveAnice !!

S.

FreeBSD massive port forwarding

Portfwd was the choice of software when I ever needed to forward a port from the server to another server – multiple hops away (not NAT port mapping).

It uses configuration like this (193.2.1.66 is the local ip, 193.2.1.80 is destination server IP):

bind-address 193.2.1.66
tcp { 55443 { => 193.2.1.80:443 } }
tcp { 55022 { => 193.2.1.80:22 } }

But it fails doing its job right when you use this on a really busy port/service (500 or more simultaneous established TCP connections).

pf does the forwarding well even over 1000 TCP connections. Example:

rdr on em0 proto tcp from any to 193.2.1.66 port 55443 -> 193.2.1.80 port 443
rdr on em0 proto tcp from any to 193.2.1.66 port 55022 -> 193.2.1.80 port 22
nat on em0 from any to 193.2.1.80 -> 193.2.1.66

– the em0 is the name of the outside interface. Without the nat rule, destination server would see a packet with source ip of the client so it would send a packet back directly to the client which causes asymmetric routing and very possible problems. The nat rule changes the source IP to the port forwarders one.

Happy forwarding,
S.

swatch – alerting you of certain log entries

A few minutes before coding my own perl script, which would alert me on certain log entries, I’ve found a software which does it’s job very well.

It’s called swatch – yes, really impressing web site and lack of documentation, examples is tipical for a geek’s tool.

example config – very simple:
watchfor /Security violation occurred/
mail addresses=ninja@level13.org,subject="SWATCH warning - switch_name"

and the command line invocation:
# /usr/local/bin/swatch -c /usr/local/etc/swatch/switch_name.conf -t /var/log/syslog/switch_name.log --daemon --use-cpan-file-tail

–daemon for forking it in the background

–use-cpan-file-tail is needed so that the swatch will tail file even after it’s rotated by the rotating script, but make sure that the perl module File::Tail is installed

It can of course match multiple patterns (multiple watchfor sections) on the same log file, but you must run multiple instances of the software for tailing multiple log files.

Make sure to read swatch man page.

S.

understanding freebsd memory usage

I think it is better to write in english, since I’m often googling around about some problem and land on a site in chinese with some configuration pasted in the site.

The problem is I don’t know what poor chinese boy wrote: “This configuration is working for me:” or “This configuration is not working at all, can someone help me:”. So I try it. Never worked.

Recently I found a post which nicely describes statuses of FreeBSD memory allocation.

Top shows:

Mem: 4589M Active, 13G Inact, 489M Wired, 733M Cache, 214M Buf, 886M Free

And the snip from the post:

Memory normally moves along the following path:

Wired -> Active -> Inactive -> Cached -> Free

and then when it gets allocated and used it moves back to Wired.

The difference between the categories is mainly that “Inactive” and
“Cached” memory still contains data that the system might be able to
reuse, while “Free” memory is completely free and unused.
In order to use Cached or Inactive memory it might need to be flushed
first, with Inactive probably being dirty and Cached probably not.
(“Active” memory is almost certainly dirty and is therefore somewhat
more expensive to reuse.

samouničenje FreeBSD-ja

Ker je jutri srečanje blogerjev, jaz pa že skoraj pol leta nisem nič napisal, imam slabo vest in pišem…

Po svetu imam kar nekaj strežnikov in pride čas, da strežnik zamenjam za novega, ob tem pa nočem da podatki pridejo v roke “nasledniku” strežnika. Poleg varnega brisanja datotek sem si vedno želel pognati kakšen destruktiven ukaz, ki bi strežnik zares pokončal.

Takoj pride ideja, dd !! Vendar je FreeBSD malo zaščitniški glede pisanja po raw diskih:

[root@dolfi ~]# dd if=/dev/zero of=/dev/da0
dd: /dev/da0: Operation not permitted

Rešitev se skriva v sysctl zastavici. Hvala, bc !

[root@dolfi ~]# sysctl kern.geom.debugflags=16

po spremembi zastavice, bo dd deloval. Uničujoče. Poskusite v službi.

Je že pospeševalec delcev uničil svet ?

http://www.hasthelargehadroncolliderdestroyedtheworldyet.com/

Lahko se tudi naročite na RSS feed…



Copyright © 2004–2009. All rights reserved.

RSS Feed. This blog is proudly powered by Wordpress and uses Modern Clix, a theme by Rodrigo Galindez.