jumpgate is a simple TCP proxy for lazy people like me.
This is my patch. You can use it freely under the 2 clause BSD license.
Usage: jumpgate -B
My Mumuring in English, about Un*x, FreeBSD, Network in Taiwan
jumpgate is a simple TCP proxy for lazy people like me.
This is my patch. You can use it freely under the 2 clause BSD license.
Usage: jumpgate -B
pass in quick on $wan1 reply-to ($wan1 $wan1gw) from !$wan1net to ($wan1) keep state
pass out route-to ($wan1 $wan1gw) proto {udp, icmp} from $wan1net to any no state
pass out route-to ($wan1 $wan1gw) proto tcp from $wan1net to any flags any no state
In FreeBSD 7.0, the pf.conf above worked. But it doesn’t work in recent 7-STABLE. The TCP session may connect successfully, but the performance is very very poor (~ 1KB/s).
I have do some research for days, but have no idea. Now I use ipfw to do policy routing…
Fireworks in Taipei 101, to celebrate 2009.
People running into the MRT station after the firework. About 1.95 million passengers served by TRTC yesterday.
Today, I found my MP4 files are full-downloaded, then played. If the size of the MP4 file is very large, I must wait for a long time. So, I tried to find some solution to hint MP4 files. mp4box just can do this job.
Although mp4box is a multiplexor for MP4 files, I just use it to hint my MP4 file:
# cd /usr/ports/multimedia/gpac-mp4box
# make install clean
# mp4box -hint video.mp4
Now, I can stream my MP4 files with Flash player.
It’s a simple thought: build a software RAID 1 disk array with an empty hard disk, and copy data on / to it. After data copied, add the old disk to the array.
For example,
(sda is the old /, and sdb is the new disk)
# sfdisk -d /dev/sda | sfdisk /dev/sdb
# mdadm -C /dev/md0 –level=raid1 –raid-devices=2 /dev/sdb1 missing
# mkfs -t ext3 /dev/md0
# mount /dev/md0 /mnt
# rsync -ax / /mnt/
# vim /etc/fstab
# vim /boot/grub/menu.lstModify fstab and menu.lst, and make sure all /dev/sda is changed to /dev/md0.
# reboot
Make sure that md0 is mounted successfully.
# mdadm –manage /dev/md0 –add /dev/sda1
Now, we successfully moved / to software RAID 1
I found that the block count sent from net/iscsi-target to a initiator is round to 2^31:
(In FreeBSD, iSCSI Target)
Starting iscsi_target.
Reading configuration from `/usr/local/etc/iscsi/targets’
target0:rw:10.1.1.0/24
extent0:/dev/stripe/gs0:0:2500582432768
DISK: 1 logical unit (4883950064 blocks, 512 bytes/block), type iscsi fs
DISK: LUN 0: 2384741 MB disk storage for “target0″
TARGET: TargetName is iqn.1994-04.org.netbsd.iscsi-target
(In Debian Linux, iSCSI initiator)
scsi 3:0:0:0: Direct-Access NetBSD NetBSD iSCSI 0 PQ: 0 ANSI: 3
sd 3:0:0:0: [sdc] 588982768 512-byte hardware sectors (301559 MB)
sd 3:0:0:0: [sdc] Write Protect is off
sd 3:0:0:0: [sdc] Mode Sense: 0e 00 00 08
sd 3:0:0:0: [sdc] Got wrong page
sd 3:0:0:0: [sdc] Assuming drive cache: write through
sd 3:0:0:0: [sdc] 588982768 512-byte hardware sectors (301559 MB)
sd 3:0:0:0: [sdc] Write Protect is off
sd 3:0:0:0: [sdc] Mode Sense: 0e 00 00 08
sd 3:0:0:0: [sdc] Got wrong page
sd 3:0:0:0: [sdc] Assuming drive cache: write through
sdc: unknown partition table
sd 3:0:0:0: [sdc] Attached SCSI disk
I don’t know if it is a iSCSI protocol or a implementation limitation.
The key point: make a symlink of jailed /libexec/ld-elf.so.1 to /libexec/ld-elf32.so.1. Of course, your kernel should have COMPAT_IA32 option compiled.
# cd /usr/src && make TARGET_ARCH=i386 TARGET=i386 buildworld
# mkdir -p /home/jails/i386 && make TARGET_ARCH=i386 TARGET=i386 DESTDIR=/home/jails/i386 installworld
# make TARGET_ARCH=i386 TARGET=i386 DESTDIR=/home/jails/i386 distribution
# ln -s /home/jails/i386/libexec/ld-elf.so.1 /home/jails/i386/libexec/ld-elf32.so.1
Then, edit rc.conf in jail to run sshd and start jails. Some utilities, like w/ps/top can not run because they retrieve data from FreeBSD kernel, and the kernel returns 64-bit structures, not 32-bit.
w
4:37AM up 12 days, 8:40, 1 user, load averages: 0.03, 0.18, 0.20
USER TTY FROM LOGIN@ IDLE WHAT
w: kinfo_proc size mismatch (expected 768, got 1088): No such file or directory
I am doing further test to make sure there aren’t any mines
Briefly, we can set the extent of iscsi-target to a ZFS volume…
But I have no idea what will happen if the size of extent is larger than it of the ZFS volume…:)
# zfs create -V 10g tank/iscsi
# cd /usr/ports/net/iscsi-target/ ; make install clean
# cat > /usr/local/etc/iscsi/targets
extent0 /dev/zvol/tank/iscsi 0 10GB
target0 rw extent0 10.0.0.0/24
^D
# /usr/local/etc/rc.d/iscsi_target forcestart
Now we can connect this iSCSI Target with some iSCSI initiator.
I went to Kaohsiung last weekend, and took KMRT, which officially started passenger service in March 2008.

Kaohsiung Main Station. There are platform screen doors for all underground stations.
I feel the KMRT is very like TMRT, but it is more crowded because of only 3 carriages for each train.
And the turnstiles are not functioned so well. I failed to return the single journey ticket in my 3 trips, and tried for the second time for success.
Recent Comments