loadYOURSELF

loadYOURSELF

Browsing Posts tagged Tip

Needed program:
Iptables

PC 1

system gateway = 192.168.2.1 (eth1)

Eth1: (connected to internet with configuration) 192.168.2.2 netmask 255.255.255.0

Eth0: (other PC connected to this port) 192.168.1.1 netmask 255.255.255.0  (with cross cable maybe)

other PC configuration : 192.168.1.2 netmask 255.255.255.0 gateway 192.168.1.1 dns 192.168.1.1

If system is configured to start with defined script below then second PC can be access to internet if it’s network address equals to 192.168.1.x and gateway is 192.168.1.1 and dns is 192.168.1.1

you can use watch command directly like this
watch –interval=1 “ps aux|grep xinetd”
to watch xinetd at a 1 second interval.
or you can define a script like this,
vi /bin/wh
press i to enter insert mode. And write

watch –interval=1 $1

then write :wq to save file
change executable attribute with chmod 755 /bin/wh
use it like this

wh “ps uax|grep xinetd”

Buy me a beer

Assign new ip =   ifconfig eth0 192.168.1.10

Assign IP/Subnet =  ifconfig eth0 192.168.1.10 netmask 255.255.255.0

Assign Default Gateway=  route add default gw 192.168.1.1

Assign multiple IP’s =  ifconfig eth0:0 192.168.1.10 netmask 255.255.255.0

Assign second IP =  ifconfig eth0:1 10.1.10.20 netmask 255.255.0.0

Buy me a beer

vi ~/testdoc
<now editing in vi>

[esc] :%!xxd

Buy me a beer

BACKUP DISK

dd if=/dev/sdX | gzip > a.gz

RESTORE BACK

gzip -dc  a.gz | dd of=/dev/sdX

Buy me a beer