Archive for the 'Uncategorized' Category

Sugarsync database reset

To reset your local SugarSync database

1. Open SugarSync Manager.
2. Click the SugarSync Manager window to select it.
3. Press and hold Command + Shift + R.
The following message appears:
“You are about to reset SugarSync Manager on this computer. Your local configuration information will be erased and the client will restart as a fresh install. Your files will not be affected. Are you sure you want to continue?”
4. Click OK.

Cheers
Pete

BGP neighbour between Juniper and Cisco reporting “unsupported/disjoint capability”

I am trying to connect a BGP session between a Juniper JunOS device and a Cisco device.

I started with a very basic ipv4 config on the JunOS device, but had a more more complicated BGP config on the Cisco side ( vpnv4 and mdt ).

As soon as I brought the connection up the Cisco router started to complain

*Jan 14 17:27:00.597: %BGP-3-NOTIFICATION: sent to neighbor 192.168.1.1 2/7 (unsupported/disjoint capability) 0 bytes  FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 003B 0104 FC00 005A 0A01 1205 1E02 0601 0400 0100 0102 0280 0002 0202 0002 0440 0200 7802 0641 0400 00FC 00

It appears there is a hidden command, to stop the routers negotiating capabilities, but that just seems wrong. What I actually needed was to match up the Juniper side with the Cisco side. In this case, I added the following family statements to the BGP config

set protocol bgp {
    family inet-vpn {
        unicast;
    }
    family inet-mdt {
        signaling;
    }
}

Now the BGP session comes up just fine.

Cheers
Pete

network interface on CentOS/redhat won’t come up

I was messing around in the network settings, and enabled IPv6 as automatic on the eth0 interface.

after that, service network stop and service network start both failed on eth0.

The error I was getting when I ran it was

[root@melvin init.d]# service network start
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/4

** (process:6538): WARNING **: _nm_object_get_property: Error getting 'State' for /org/freedesktop/NetworkManager/ActiveConnection/4: (19) Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" doesn't exist

state: unknown
Error: Connection activation failed.
                                                           [FAILED]
[root@melvin init.d]# 

As it turned out, the problem was the IPv6. If look at dmesg, I see

e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
8021q: adding VLAN 0 to HW filter on device eth0
eth0: no IPv6 routers present
lo: Disabled Privacy Extensions
eth0: no IPv6 routers present

Which is fair enough because I have not setup IPv6 on the network in any useful fashion.

The fix was to change IPv6 to LinkOnly, and worry about IPv6 later.

I would be nice if the message back from the ifup script was more descriptive though, I wonder how many other people have wasted time trying to work this out.

Cheers
Pete

filtering OSPF routes

Our external routers run full routes, but on the internal network the routers don’t have sufficient memory, nor do they need full routes.

To ensure that someone does not blow them up be accidently advertising full routes into the internal network, we filter the routes they will accept.

To do this, we configure a distribution-list on the router we are trying to protect.

lets say our block of address space is 170.12.42.0/23

ip prefix-list AS1234-filter seq 5 permit 170.12.42.0/23 le 32
ip prefix-list AS1234-filter seq 10 permit 0.0.0.0/0

then we add this to the OSPF router process

router ospf 1
 router-id 192.168.1.1
 log-adjacency-changes
 distribute-list prefix AS1234-filter in

Now you should only see the routes you need ( and the default router in this example ) in your router process

Cheers
Pete

undeleting photos with testdisk

Opps.

I imported a load of photos, and deleted the contents of the camera. Later, I managed to delete the imported versions :-(

There are loads of shareware undelete tools, but as soon as they find the files they want you to pay to restore them. I found this tool TestDisk.

I was lucky that I had not taken any more photos on the flash card, and TestDisk did a good job of restoring all the files. The photo’s are ok, but the movies appear to be broken. At least I have the files to work with though.

If you found this page because you have lost some of your Photo’s, I really hope TestDisk works for you.

Cheers
Pete

I get 0:0:0:0:0:0:0:1%0 when I call request.remote_ip in rails

I was looking for the remote browsers ip’s in a rails application today, and created the following method in my controller.

  def remote_ip
    IPAddress.parse ( request.remote_ip )
  end

The idea was simply to be create a NetAddr object from the ip address so that it could be manipulated in the view.

The code does not work, because with ipv6 the remote_ip returns returns

0:0:0:0:0:0:0:1%0

and NetAddr does not appear to like the % syntax. I tried the same request from a remote computer to try and work out the syntax it was giving me, and to try and work out the relevance of the number after the %, and got

2001:7a3:ee23:2:20c:29ff:fe19:8878%0

I can’t bring myself to just cut this information off without knowing what it means, so eventually I found RFC 4007 which is titled ‘IPv6 Scoped Address Architecture’. If you read section 11 you will see that the % syntax refers to the zone id which is the interface on the source host. I understand the point of this, but for the sake of getting the remote ipv6 address in my rails application, I probably don’t need it. To create the IPAddress object, I just need to use the address preceding the %. This seems to suffice

def remote_ip
    IPAddress.parse ( request.remote_ip.split("%").first )
end

Which when I look at the page gives me

2001:7a3:ee23:2:20c:29ff:fe19:8878

Which will do just fine

Cheers
Pete

Macports – port selfupdate failed

I was struggling with updating macports

bozo:macports pete$ /opt/local/bin/port selfupdate
--->  Updating the ports tree
Error: Synchronization of the local ports tree failed doing rsync
Error: /opt/local/bin/port: port selfupdate failed: Couldn't sync the ports tree: Synchronization of 1 source(s) failed
bozo:macports pete$

I discovered that you can run self update in debug more

bozo:bin pete$ ./port -d selfupdate
--->  Updating the ports tree
DEBUG: Synchronizing ports tree(s)
Synchronizing local ports tree from rsync://rsync.macports.org/release/ports/
DEBUG: /usr/bin/rsync -rtzv --delete-after '--exclude=/PortIndex*' rsync://rsync.macports.org/release/ports/ /opt/local/var/macports/sources/rsync.macports.org/release/ports
receiving file list ... done
rsync: failed to set times on "/opt/local/var/macports/sources/rsync.macports.org/release/ports/.": Operation not permitted (1)
./
rsync: failed to set times on "/opt/local/var/macports/sources/rsync.macports.org/release/ports/.": Operation not permitted (1)

So the problem was simply that I needed to run it as root, rather than as me but the error message from mac ports is not clear

Anyway, I hope -d helps you out.

Cheers
Pete

OSX Spaces slide show

I setup a couple of mac mini’s at work to run the various monitoring screens. For a while we have used a little piece of java script to switch between browser tabs, but its a bit limited, and there are a few monitoring tools we have that are not web based and only run on windows.

Using Virtual Box I setup a couple of windows machines, and then for each tool I wanted to display, I created a space and made a virtual machine full screen to run the tool.

At the moment, I have 3 browsers on 3 spaces, and then two virtual machines on an additional 2 spaces. Now I need to turn it into a slide show.

I created a little AppleScript script to switch the screens. Its rather crude in that it sends key codes to the system events application and, I can’t seem to get the application to exit gracefully when I do file->quit.

Here is the script

(* 
 
Title: Spaces slide show
 
list of apple key codes is a available here:
http://lists.apple.com/archives/Applescript-users/2004/Apr/msg00076.html
 
*)
 
(* Don't set switch_delay to less that 2, you might lock up your machine whilst it madly switches between spaces *)
set switch_delay to 5
 
repeat
	tell application "System Events"
		key code 124 using {control down}
		delay switch_delay
	end tell
end repeat

update 1: I had one issue where the screen switching would stop when it got to a screen that was running virtual box. If you go to Virtual box settings, there is an option to automatically capture the keyboard, this needs to be disabled to make it work.

update 2: The swish effect becomes quite annoying quite quickly.

defaults write com.apple.dock workspaces-swoosh-animation-off -bool YES
killall Dock

This seems to do the trick for now.

Cheers
Pete

Emotional response to an email defined as a regex and ternary syntax

Version 1.0

irb(main):052:0> email="Hi Pete,\nblah blah blah\n\ncheers\nSomeone"
=> "Hi Pete,\nblah blah blah\n\ncheers\nPete"
irb(main):053:0> email.match(/^(hi|hello|dear)\ [a-zA-Z]*,\n([\s\w]*)\n\n(cheers|thanks|regards|kind regards|ta)\n[a-zA-Z]*$/i) ? "happy" : "not-happy"
=> "happy"

TODO:
* ensure names start with :upper:
* weedle out duplicate punctuation i.e. .. or !!! etc

Using SCP to copy files to a Cisco router

Getting files onto a cisco router does not need to be hard

router(config)#ip scp server enable
router(config)#username pete privilege 15 password 0 secret

Then you can simply SCP the file

host123:Downloads pete$ scp anyconnect-macosx-i386-2.5.1025-k9.dmg pete@router:anyconnect-macosx-i386-2.5.1025-k9.pkg
Password:
anyconnect-macosx-i386-2.5.1025-k9.pkg                                                                   100% 4560KB 106.1KB/s   00:43
host123:Downloads pete$

Cheers
Pete

Update: It appears on IOS later than 12.4(24)T3, you need to also configure AAA for this to work, otherwise you get a “Permission denied” error when you try and SCP the file.

aaa new-model
aaa authentication login default local
aaa authorization exec default local