Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Saturday, June 7, 2025

Debian 12 to share internet

1. Download The Debian Bookworm network installation CD

2. install follow steps and on set software unselect all

note command to see network

   ip a

3 sudo nano /etc/network/interfaces


3.1 sudo systemctl restart networking
3.2 echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
3.3 sudo nano /etc/sysctl.conf
    uncomment #
    net.ipv4.ip_forward=1
3.4 sudo sysctl -p
3.5 
sudo iptables -t nat -A POSTROUTING -o enx000ec6c29c18-j MASQUERADE
sudo iptables -A FORWARD -i ens33 -o enx000ec6c29c18 -j ACCEPT
sudo iptables -A FORWARD -i enx000ec6c29c18 -o ens33 -m state --state RELATED,ESTABLISHED -j ACCEPT
3.6 sudo apt install iptables-persistent


sudo nano /etc/apt/sources.list


sudo apt update && sudo apt upgrade
sudo apt install open-vm-tools isc-dhcp-server
sudo nano /etc/dhcp/dhcpd.conf

sudo nano /etc/default/isc-dhcp-server

sudo systemctl restart isc-dhcp-server

  sudo systemctl enable isc-dhcp-server

8 sudo crontab -e

select nano

0 3 * * * /sbin/shutdown -r now

Thursday, August 29, 2024

pxelinux to ipxe howto (to boot bios method)

 TFTP root (Also HTTP root here)

       |- netboot
        |- boot.ipxe
        |- chain.c32   (syslinux)
        |- ipxe.lkrn   (download from ipxe.org)
        |- ldlinux.c32 (syslinux)
        |- libutil.c32 (syslinux)
        |- ldlinux.c32 (syslinux)
        |- memdisk     (syslinux)
        |- menu.c32    (syslinux)
        |- pxelinux.0  (syslinux)
        |- pxelinux.0? (link for fix bug tinycore)
        |- pxelinux.cfg
        || - default
|- tc (tinycore) || - core.gz
        || - vmlinuz

boot.ipxe
  #!ipxe
  
  dhcp
  chain http://boot.ipxe.org/demo/boot.php
default
DEFAULT menu.c32
PROMPT 0
MENU TITLE Boot Menu
TIMEOUT 50

LABEL local
    MENU LABEL 1 Boot local hard drive
    LOCALBOOT 0

LABEL core
    MENU LABEL 2 TINYCORE
    KERNEL /tc/vmlinuz
    APPEND initrd=/tc/core.gz

LABEL 1_ipxe
    MENU LABEL 3 IPXE (Network Boot)
    KERNEL ipxe.lkrn
    APPEND dhcp && chain http://boot.ipxe.org/demo/boot.php

LABEL 2_ipxe
    MENU LABEL 4 IPXE (Boot from file)
    KERNEL ipxe.lkrn
    APPEND boot.ipxe

Thursday, September 28, 2023

tinycore15 share internet add pxeserver support

 tce-update

 tce-load -wi dnsmaq

 tce-load -wi ipv6-netfilter-6.6.8-tinycore

 tce-load -wi iptables


/opt/bootlocal.sh

#!/bin/sh

# put other system startup commands here

/opt/eth1.sh &

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE &

sudo iptables -A FORWARD -i eth1 -j ACCEPT &

sudo dnsmasq &

sudo sysctl -w net.ipv4.ip_forward=1 &

         sudo crond &


/opt/eth1.sh

#!/bin/sh


# If you are booting Tiny Core from a very fast storage such as SSD / NVMe Drive and getting 

# "ifconfig: SIOCSIFADDR: No such Device" or "route: SIOCADDRT: Network is unreachable"

# error during system boot, use this sleep statemet, otherwise you can remove it -

sleep 1


# kill dhcp client for eth1

sleep 1

if [ -f /var/run/udhcpc.eth1.pid ]; then

sudo kill `cat /var/run/udhcpc.eth1.pid`

sleep 1

fi


# configure interface eth1

sudo ifconfig eth1 192.168.137.1 netmask 255.255.255.0 broadcast 192.168.137.255 up


# Start the DHCP Server Process once the Interface is Ready with the IP Add

sleep 1

sudo udhcpd /etc/eth1_udhcpd.conf &

         sudo udpsvd -E 0 69 tftpd /netboot 

 

/etc/eth1_udhcpd.conf

max_leases 101

lease_file /opt/udhcpd.leases

start 192.168.137.100

end 192.168.137.200

interface eth1

         boot_file /pxelinux.0

         option tftp 192.168.137.1 

option subnet 255.255.255.0

option router 192.168.137.1

option lease 43200

option dns 192.168.137.1

option domain local

 

/opt/.filetool.lst

opt

home

         /netboot 

/etc/eth1_udhcpd.conf

        /var/spool/crond/crontabs/root 

/var/spool/crond/crontabs/root 

    SHELL=/bin/sh

    15 22 * * * /sbin/reboot > /tmp/reboot.log 2>&1

After

    filetool.sh -b

PXE server

    mkdir -p /netboot/pxelinux.cfg

    /netboot/tc/core.gz

    /netboot/tc/vmlinz

    /netboot/pxelinux.0      --> from sysliux

/netboot/pxelinux.cfg/default

    DEFAULT core

    TIMEOUT 300

    

    LABEL core

        KERNEL /tc/vmlinuz

        APPEND quiet initrd=/tc/core.gz

ln -s /netboot/pxelinux.0 /netboot/pxelinux.0     --> bug busybox udhcpd


how to update 14->15

/mnt/sda1/tce/boot/
replace corepure64.gz and vmlinuz64 to new version
1 rm corepure64.gz
2 rm vmlinuz64
3 wget http://tinycorelinux.net/16.x/x86_64/release/distribution_files/corepure64.gz
4 wget http://tinycorelinux.net/16.x/x86_64/release/distribution_files/vmlinuz64
5.tce-update
remove old extension
    /etc/sysconfig/tcedir/optional/
install new use
tce
s = search extension
ipv6
select menu and show detail extension
q = quit to menu
i = install

Tuesday, February 8, 2022

Sudo with NO password

 cd /etc/sudoer.d

sudo visudo

# add

Username ALL=(ALL) NOPASSWD:ALL

#save

Monday, October 4, 2021

Easy free ftpserver windows for tranfer file between vm to host

#for download software

https://www.sentex.ca/~mwandel/ftpdmin/

#example for run FTP server

ftpdmin.exe c:\me

#command upload

busybox ftpput 192.168.0.86 block.txt

#command download

busybox ftpget 192.168.0.86 block.txt


Thursday, March 4, 2021

WSL for window10 and remote desktop

WSL commands: 
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2

Download ubuntu wsl from microsoft store


Ubuntu commands:

sudo apt update && sudo apt -y upgrade

sudo apt-get install -y xrdp xfce4 xfce4-goodies

configure :
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini
echo xfce4-session > ~/.xsession

sudo nano /etc/xrdp/startwm.sh
comment these lines to:
#test -x /etc/X11/Xsession && exec /etc/X11/Xsession
#exec /bin/sh /etc/X11/Xsession

add these lines:
# xfce
startxfce4

sudo /etc/init.d/xrdp start

Now in Windows, use Remote Desktop Connection
localhost:3390
then login with Xorg, fill in your username and password.

Thursday, August 21, 2014

how to install DWM-156 for linux server (ubuntu)





first

change usb modem mode ( from cd to modem)

mkdir /media/cdrom
mount /dev/srX /media/cdrom
X is 0,1,2,3...

install dlinkusbmodem.deb

sudo dpkg -i dlinkusbmodem.deb 

run that file 


usbdeviceswitchdlink

setting usb modem mode

 sudo modprobe usbserial vendor=0x2001 product=0x7D00

Note make sure already install wvdial

sudo apt-get install wvdial

Setting wvdial.conf

wvdialconf

sudo vi /etc/wvdial.conf

remove ; in wvdial.conf
Example of file

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","internet"
Phone = *99#
Modem Type = Analog Modem
Stupid Mode = 1
Baud = 9600
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Password = ;
Username = ;


and start dial by

sudo wvdial


setting gateway

route add default gw 192.168.1.254 eth0

Friday, May 16, 2014

ubuntu telnet server

sudo apt-get install telnetd

 sudo /etc/init.d/inetd restart

Wednesday, February 12, 2014

ubuntu share internet

Before I begin this post, I want to thank Internet Connection Sharing – Ubuntu 10.04 NAT Gateway Setup (Abridged Version) for providing the bulk of the tutorial. I have made some modifications for Ubuntu 12.04.
The setup is simple: a single Ubuntu server will act as a gateway and DHCP server for a local network. All other machines on the local network will receive their IPs from the DHCP server. To make things easier, I’ll call this Ubuntu server “Skyray” for the rest of the post.
Skyray has two network interfaces, eth0 and eth1. eth0 is on the 10.20.30.0/24 subnet and this is the Internet facing interface. eth1 is on the 172.22.22.0/24 subnet, where all other machines are also present. Basically, eth0 will connect to the Internet and eth1 will serve DHCP requests and act as the gateway.

/etc/network/interfaces

First you need to configure eth0 and eth1 for Skyray. Edit the file and make sure it has at least the following settings (or whatever settings are appropriate for your environment).
sudo vim /etc/network/interfaces
(:wq save and quit, i insert mode , esc exit insert mode, :q! exit not save)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
    address 192.168.10.1
    netmask 255.255.255.0
    network 192.168.10.0
    broadcast 192.168.10.255

/etc/sysctl.conf

You need to enable IPv4 forwarding. To do so, edit this file.
sudo vim /etc/sysctl.conf
And uncomment the line
# net.ipv4.ip_forward=1
so that it now appears as
net.ipv4.ip_forward=1
Save the file and run the following command to make the change effective without a reboot.
sudo sysctl -w net.ipv4.ip_forward=1

/etc/rc.local

You’ll need to allow iptables rules for NAT to work. Edit the file and save it.
sudo vim /etc/rc.local
Make sure the following two lines appear before the exit 0 line in the file.
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE
To make these iptables rules active without rebooting, run the following commands:
sudo iptables -P FORWARD ACCEPT
sudo iptables –-table nat -A POSTROUTING -o eth0 -j MASQUERADE

Thursday, September 1, 2011

ELF & CHMOD

create symbol link

ln -s -f libsource libnew

chmod (set permittion)

chmod 755 file

Tuesday, June 7, 2011

problem linux prapop is not in the sudoers file. This incident will be reported

su - echo 'prapop ALL=(ALL) ALL' >> /etc/sudoers

Sunday, February 13, 2011

set path in linux

For bash shell:
export PATH=$PATH:/usr/sbin/:/usr/local/bin:/var/harddisk/asus/bin

export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/harddisk/asus/lib:/var/harddisk/lib