Thursday, August 29, 2013

Linux Bandwidth Management

1. Menggunakan HTB

HTB example

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 11

tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 2kbps ceil 2kbps
tc class add dev eth0 parent 1:1 classid 1:12 htb rate 50kbps ceil 50kbps

tc filter replace dev eth0 \
 protocol ip parent 1: prio 1 handle 0x19 fw flowid 1:12

iptables -t mangle -F
iptables -t mangle -A POSTROUTING -d 195.47.235.3 -j MARK --set-mark 0x19
 
 
Untuk menangkap trafik paket yang cache hit dari mesin proxy remote yang mempunyai TOS 0×30 atau DSCP 12, ada dua cara yang bisa dilakukan untuk traffic control di linux (Note: eth0 adalah LAN device):
  1. Buat class untuk menangkap trafik cache hit dan set filter seperti di bawah ini:
    tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip protocol 0x6 \
        0xff match ip tos 0x30 0xff flowid 1:68
    
  2. Buat iptables mangle dan set mark untuk trafik cache hit seperti di bawah ini:
    iptables -A FORWARD -t mangle -p tcp -m dscp --dscp 12 -j MARK --set-mark 0x212
    
Sekarang bandingkan hasil dari dua perintah di bawah ini:
  1. tc -s -d class show dev eth0
    ...
    class htb 1:68 parent 1:66 leaf 68: prio 0 quantum 60000 rate 100000Kbit ceil 100000Kbit burst 126575b/8 mpu 0b overhead 0b cburst 126575b/8 mpu 0b overhead 0b level 0 
    Sent 679063 bytes 665 pkts (dropped 0, overlimits 0)
     rate 136bit
     lended: 665 borrowed: 0 giants: 0
     tokens: 8265 ctokens: 8265
    
  2. iptables -L FORWARD -t mangle -nv
    Chain FORWARD (policy ACCEPT 255K packets, 127M bytes)
     pkts bytes target   prot opt in   out   source      destination         
      665  670K MARK     tcp  --  *    *     0.0.0.0/0   0.0.0.0/0     DSCP match 0x0c MARK set 0x1
    

 
 

Wednesday, August 28, 2013

instal SNMP di Linux

  Installing Net-SNMP

daftar paket yang di-install
Package Provides
net-snmp The SNMP Agent Daemon and documentation. This package is required for exporting performance data.
net-snmp-libs The netsnmp library and the bundled management information bases (MIBs). This package is required for exporting performance data.
net-snmp-utils SNMP clients such as snmpget and snmpwalk. This package is required in order to query a system's performance data over SNMP.
net-snmp-perl The mib2c utility and the NetSNMP Perl module.
net-snmp-python An SNMP client library for Python.

~]# yum install net-snmp net-snmp-libs net-snmp-utils


menjalankan Net-SNMP Daemon

Starting the Service

menjalankan snmpd service 
systemctl start snmpd.service
mejalankan otomatis saat boot:
systemctl enable snmpd.service

Stop Service

untuk mematikan snmpd service,dengan perintah :
systemctl stop snmpd.service
mematikan service agar tidak berjalan saat boot
systemctl disable snmpd.service

Restart Service

untuk restart:
systemctl restart snmpd.service
untuk membaca konfigurasi baru tanpa restart:
systemctl reload snmpd.service

Konfigurasi Net-SNMP

Untuk merubah konfigurasi edit file /etc/snmp/snmpd.conf 
utility untuk konfigurasi paket net-snmp dapat menggunakan snmpconf 
net-snmp-utils paket harus diinstall untuk menggunakan perintah snmpwalk 

16.5.3.1. Setting System Information

Net-SNMP provides some rudimentary system information via the system tree. For example, the following snmpwalk command shows the system tree with a default agent configuration.
~]# snmpwalk -v2c -c public localhost system
SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.32-122.el6.x86_64 #1 SMP Wed Mar 9 23:54:34 EST 2011 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (99554) 0:16:35.54
SNMPv2-MIB::sysContact.0 = STRING: Root  (configure /etc/snmp/snmp.local.conf)
SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain
SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)
By default, the sysName object is set to the hostname. The sysLocation and sysContact objects can be configured in the /etc/snmp/snmpd.conf file by changing the value of the syslocation and syscontact directives, for example:
syslocation Datacenter, Row 3, Rack 2
syscontact UNIX Admin 
After making changes to the configuration file, reload the configuration and test it by running the snmpwalk command again:
~]# systemct reload snmpd.service
~]# snmpwalk -v2c -c public localhost system
SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.32-122.el6.x86_64 #1 SMP Wed Mar 9 23:54:34 EST 2011 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (158357) 0:26:23.57
SNMPv2-MIB::sysContact.0 = STRING: UNIX Admin 
SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain
SNMPv2-MIB::sysLocation.0 = STRING: Datacenter, Row 3, Rack 2

16.5.3.2. Configuring Authentication

The Net-SNMP Agent Daemon supports all three versions of the SNMP protocol. The first two versions (1 and 2c) provide for simple authentication using a community string. This string is a shared secret between the agent and any client utilities. The string is passed in clear text over the network however and is not considered secure. Version 3 of the SNMP protocol supports user authentication and message encryption using a variety of protocols. The Net-SNMP agent also supports tunneling over SSH, TLS authentication with X.509 certificates, and Kerberos authentication.
Configuring SNMP Version 2c Community
To configure an SNMP version 2c community, use either the rocommunity or rwcommunity directive in the /etc/snmp/snmpd.conf configuration file. The format of the directives is the following:
directive community [source [OID]]
… where community is the community string to use, source is an IP address or subnet, and OID is the SNMP tree to provide access to. For example, the following directive provides read-only access to the system tree to a client using the community string redhat on the local machine:
rocommunity redhat 127.0.0.1 .1.3.6.1.2.1.1
To test the configuration, use the snmpwalk command with the -v and -c options.
~]# snmpwalk -v2c -c redhat localhost system
SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.32-122.el6.x86_64 #1 SMP Wed Mar 9 23:54:34 EST 2011 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (158357) 0:26:23.57
SNMPv2-MIB::sysContact.0 = STRING: UNIX Admin 
SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain
SNMPv2-MIB::sysLocation.0 = STRING: Datacenter, Row 3, Rack 2
Configuring SNMP Version 3 User
To configure an SNMP version 3 user, use the net-snmp-create-v3-user command. This command adds entries to the /var/lib/net-snmp/snmpd.conf and /etc/snmp/snmpd.conf files which create the user and grant access to the user. Note that the net-snmp-create-v3-user command may only be run when the agent is not running. The following example creates the sysadmin user with the password redhatsnmp:
~]# systemctl stop snmpd.service
~]# net-snmp-create-v3-user
Enter a SNMPv3 user name to create:
admin
Enter authentication pass-phrase:
redhatsnmp
Enter encryption pass-phrase:
  [press return to reuse the authentication pass-phrase]

adding the following line to /var/lib/net-snmp/snmpd.conf:
   createUser admin MD5 "redhatsnmp" DES
adding the following line to /etc/snmp/snmpd.conf:
   rwuser admin
~]# systemctl start snmpd.service
The rwuser directive (or rouser when the -ro command line option is supplied) that net-snmp-create-v3-user adds to /etc/snmp/snmpd.conf has a similar format to the rwcommunity and rocommunity directives:
directive user [noauth|auth|priv] [OID]
… where user is a username and OID is the SNMP tree to provide access to. By default, the Net-SNMP Agent Daemon allows only authenticated requests (the auth option). The noauth option allows you to permit unauthenticated requests, and the priv option enforces the use of encryption. The authpriv option specifies that requests must be authenticated and replies should be encrypted.
For example, the following line grants the user admin read-write access to the entire tree:
rwuser admin authpriv .1
To test the configuration, create a .snmp directory in your user's home directory and a configuration file named snmp.conf in that directory (~/.snmp/snmp.conf) with the following lines:
defVersion 3
defSecurityLevel authPriv
defSecurityName admin
defPassphrase redhatsnmp
The snmpwalk command will now use these authentication settings when querying the agent:
~]$ snmpwalk -v3 localhost system
SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.32-122.el6.x86_64 #1 SMP Wed Mar 9 23:54:34 EST 2011 x86_64
[output truncated]
 
 

 Retrieving Performance Data over SNMP

The Net-SNMP Agent in Fedora provides a wide variety of performance information over the SNMP protocol. In addition, the agent can be queried for a listing of the installed RPM packages on the system, a listing of currently running processes on the system, or the network configuration of the system.
This section provides an overview of OIDs related to performance tuning available over SNMP. It assumes that the net-snmp-utils package is installed and that the user is granted access to the SNMP tree as described in Section 16.5.3.2, “Configuring Authentication”.

16.5.4.1. Hardware Configuration

The Host Resources MIB included with Net-SNMP presents information about the current hardware and software configuration of a host to a client utility. Table 16.3, “Available OIDs” summarizes the different OIDs available under that MIB.
Table 16.3. Available OIDs
OID Description
HOST-RESOURCES-MIB::hrSystem Contains general system information such as uptime, number of users, and number of running processes.
HOST-RESOURCES-MIB::hrStorage Contains data on memory and file system usage.
HOST-RESOURCES-MIB::hrDevices Contains a listing of all processors, network devices, and file systems.
HOST-RESOURCES-MIB::hrSWRun Contains a listing of all running processes.
HOST-RESOURCES-MIB::hrSWRunPerf Contains memory and CPU statistics on the process table from HOST-RESOURCES-MIB::hrSWRun.
HOST-RESOURCES-MIB::hrSWInstalled Contains a listing of the RPM database.

There are also a number of SNMP tables available in the Host Resources MIB which can be used to retrieve a summary of the available information. The following example displays HOST-RESOURCES-MIB::hrFSTable:
~]$ snmptable -Cb localhost HOST-RESOURCES-MIB::hrFSTable
SNMP table: HOST-RESOURCES-MIB::hrFSTable

 Index MountPoint RemoteMountPoint                                Type
    Access Bootable StorageIndex LastFullBackupDate LastPartialBackupDate
     1        "/"               "" HOST-RESOURCES-TYPES::hrFSLinuxExt2
 readWrite     true           31      0-1-1,0:0:0.0         0-1-1,0:0:0.0
     5 "/dev/shm"               ""     HOST-RESOURCES-TYPES::hrFSOther
 readWrite    false           35      0-1-1,0:0:0.0         0-1-1,0:0:0.0
     6    "/boot"               "" HOST-RESOURCES-TYPES::hrFSLinuxExt2
 readWrite    false           36      0-1-1,0:0:0.0         0-1-1,0:0:0.0
For more information about HOST-RESOURCES-MIB, see the /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt file.

16.5.4.2. CPU and Memory Information

Most system performance data is available in the UCD SNMP MIB. The systemStats OID provides a number of counters around processor usage:
~]$ snmpwalk localhost UCD-SNMP-MIB::systemStats
UCD-SNMP-MIB::ssIndex.0 = INTEGER: 1
UCD-SNMP-MIB::ssErrorName.0 = STRING: systemStats
UCD-SNMP-MIB::ssSwapIn.0 = INTEGER: 0 kB
UCD-SNMP-MIB::ssSwapOut.0 = INTEGER: 0 kB
UCD-SNMP-MIB::ssIOSent.0 = INTEGER: 0 blocks/s
UCD-SNMP-MIB::ssIOReceive.0 = INTEGER: 0 blocks/s
UCD-SNMP-MIB::ssSysInterrupts.0 = INTEGER: 29 interrupts/s
UCD-SNMP-MIB::ssSysContext.0 = INTEGER: 18 switches/s
UCD-SNMP-MIB::ssCpuUser.0 = INTEGER: 0
UCD-SNMP-MIB::ssCpuSystem.0 = INTEGER: 0
UCD-SNMP-MIB::ssCpuIdle.0 = INTEGER: 99
UCD-SNMP-MIB::ssCpuRawUser.0 = Counter32: 2278
UCD-SNMP-MIB::ssCpuRawNice.0 = Counter32: 1395
UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32: 6826
UCD-SNMP-MIB::ssCpuRawIdle.0 = Counter32: 3383736
UCD-SNMP-MIB::ssCpuRawWait.0 = Counter32: 7629
UCD-SNMP-MIB::ssCpuRawKernel.0 = Counter32: 0
UCD-SNMP-MIB::ssCpuRawInterrupt.0 = Counter32: 434
UCD-SNMP-MIB::ssIORawSent.0 = Counter32: 266770
UCD-SNMP-MIB::ssIORawReceived.0 = Counter32: 427302
UCD-SNMP-MIB::ssRawInterrupts.0 = Counter32: 743442
UCD-SNMP-MIB::ssRawContexts.0 = Counter32: 718557
UCD-SNMP-MIB::ssCpuRawSoftIRQ.0 = Counter32: 128
UCD-SNMP-MIB::ssRawSwapIn.0 = Counter32: 0
UCD-SNMP-MIB::ssRawSwapOut.0 = Counter32: 0
In particular, the ssCpuRawUser, ssCpuRawSystem, ssCpuRawWait, and ssCpuRawIdle OIDs provide counters which are helpful when determining whether a system is spending most of its processor time in kernel space, user space, or I/O. ssRawSwapIn and ssRawSwapOut can be helpful when determining whether a system is suffering from memory exhaustion.
More memory information is available under the UCD-SNMP-MIB::memory OID, which provides similar data to the free command:
~]$ snmpwalk localhost UCD-SNMP-MIB::memory
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 1023992 kB
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 1023992 kB
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 1021588 kB
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 634260 kB
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 1658252 kB
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 30760 kB
UCD-SNMP-MIB::memCached.0 = INTEGER: 216200 kB
UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:
Load averages are also available in the UCD SNMP MIB. The SNMP table UCD-SNMP-MIB::laTable has a listing of the 1, 5, and 15 minute load averages:
~]$ snmptable localhost UCD-SNMP-MIB::laTable
SNMP table: UCD-SNMP-MIB::laTable

 laIndex laNames laLoad laConfig laLoadInt laLoadFloat laErrorFlag laErrMessage
       1  Load-1   0.00    12.00         0    0.000000     noError
       2  Load-5   0.00    12.00         0    0.000000     noError
       3 Load-15   0.00    12.00         0    0.000000     noError

16.5.4.3. File System and Disk Information

The Host Resources MIB provides information on file system size and usage. Each file system (and also each memory pool) has an entry in the HOST-RESOURCES-MIB::hrStorageTable table:
~]$ snmptable -Cb localhost HOST-RESOURCES-MIB::hrStorageTable
SNMP table: HOST-RESOURCES-MIB::hrStorageTable

 Index                                         Type           Descr
AllocationUnits    Size   Used AllocationFailures
     1           HOST-RESOURCES-TYPES::hrStorageRam Physical memory
1024 Bytes 1021588 388064                  ?
     3 HOST-RESOURCES-TYPES::hrStorageVirtualMemory  Virtual memory
1024 Bytes 2045580 388064                  ?
     6         HOST-RESOURCES-TYPES::hrStorageOther  Memory buffers
1024 Bytes 1021588  31048                  ?
     7         HOST-RESOURCES-TYPES::hrStorageOther   Cached memory
1024 Bytes  216604 216604                  ?
    10 HOST-RESOURCES-TYPES::hrStorageVirtualMemory      Swap space
1024 Bytes 1023992      0                  ?
    31     HOST-RESOURCES-TYPES::hrStorageFixedDisk               /
4096 Bytes 2277614 250391                  ?
    35     HOST-RESOURCES-TYPES::hrStorageFixedDisk        /dev/shm
4096 Bytes  127698      0                  ?
    36     HOST-RESOURCES-TYPES::hrStorageFixedDisk           /boot
1024 Bytes  198337  26694                  ?
The OIDs under HOST-RESOURCES-MIB::hrStorageSize and HOST-RESOURCES-MIB::hrStorageUsed can be used to calculate the remaining capacity of each mounted file system.
I/O data is available both in UCD-SNMP-MIB::systemStats (ssIORawSent.0 and ssIORawRecieved.0) and in UCD-DISKIO-MIB::diskIOTable. The latter provides much more granular data. Under this table are OIDs for diskIONReadX and diskIONWrittenX, which provide counters for the number of bytes read from and written to the block device in question since the system boot:
~]$ snmptable -Cb localhost UCD-DISKIO-MIB::diskIOTable
SNMP table: UCD-DISKIO-MIB::diskIOTable

 Index Device     NRead  NWritten Reads Writes LA1 LA5 LA15    NReadX NWrittenX
...
    25    sda 216886272 139109376 16409   4894   ?   ?    ? 216886272 139109376
    26   sda1   2455552      5120   613      2   ?   ?    ?   2455552      5120
    27   sda2   1486848         0   332      0   ?   ?    ?   1486848         0
    28   sda3 212321280 139104256 15312   4871   ?   ?    ? 212321280 139104256

16.5.4.4. Network Information

Information on network devices is provided by the Interfaces MIB. IF-MIB::ifTable provides an SNMP table with an entry for each interface on the system, the configuration of the interface, and various packet counters for the interface. The following example shows the first few columns of ifTable on a system with two physical network interfaces:
~]$ snmptable -Cb localhost IF-MIB::ifTable
SNMP table: IF-MIB::ifTable

 Index Descr             Type   Mtu    Speed      PhysAddress AdminStatus
     1    lo softwareLoopback 16436 10000000                           up
     2  eth0   ethernetCsmacd  1500        0 52:54:0:c7:69:58          up
     3  eth1   ethernetCsmacd  1500        0 52:54:0:a7:a3:24        down
Network traffic is available under the OIDs IF-MIB::ifOutOctets and IF-MIB::ifInOctets. The following SNMP queries will retrieve network traffic for each of the interfaces on this system:
~]$ snmpwalk localhost IF-MIB::ifDescr
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifDescr.3 = STRING: eth1
~]$ snmpwalk localhost IF-MIB::ifOutOctets
IF-MIB::ifOutOctets.1 = Counter32: 10060699
IF-MIB::ifOutOctets.2 = Counter32: 650
IF-MIB::ifOutOctets.3 = Counter32: 0
~]$ snmpwalk localhost IF-MIB::ifInOctets
IF-MIB::ifInOctets.1 = Counter32: 10060699
IF-MIB::ifInOctets.2 = Counter32: 78650
IF-MIB::ifInOctets.3 = Counter32: 0
 

rubah runlevel dengan systemctl

cara merubah runlevel

pada systemd tidak lagi menggunakan file inittab
run level 3 adalah runlevel multiuser
run level 5 adalah run level grafis mode
merubah ke 'runlevel 3' dengan menjalankan perintah 
 systemctl isolate multi-user.target (or) systemctl isolate runlevel3.target 
merubah ke  'runlevel 5' dengan perintah 
 systemctl isolate graphical.target (or) systemctl isolate runlevel5.target 

merubah default runlevel

pertama hapus symlinks default runlevel
 rm /etc/systemd/system/default.target 
Switch ke runlevel 3 sebagai default
 ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target 
Switch ke runlevel 5 sebagai default
 ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target 

mengetahui runlevel yg aktif


 systemctl list-units --type=target 




selesai

Tuesday, August 27, 2013

membuat bridge di linux


cara membuat bridge di linux

download brctl-utils
gunakan perintah berikut :
"/usr/sbin/brctl addbr br0"
"/usr/sbin/brctl stp br0 on"
"/usr/sbin/brctl addif br0 eth0"
/usr/sbin/brctl addif br0 eth1"
/sbin/ifconfig eth0 down"
/sbin/ifconfig eth1 down"
/sbin/ifconfig eth0 0.0.0.0 up"
/sbin/ifconfig eth1 0.0.0.0 up"
/sbin/ifconfig br0 172.16.240.4 netmask 255.255.255.224 up"
echo 1 > /proc/sys/net/ipv4/ip_forward"
echo 1 > /proc/sys/net/bridge/bridge-nf-call-arptables"
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables"
echo 1 > /proc/sys/net/ipv4/tcp_syncookies"
echo 524288 > /proc/sys/net/ipv4/route/max_size"
/sbin/route add default gw 172.16.240.1"

menjalan script otomatis di linux

cara menjalankan script otomatis saat boot di linux

buat file /etc/rc.local
chmod +x /etc/rc.local
edit file /etc/rc.local
tambahkan
#!/bin/bash

kemudian jalankan perintah
  systemctl enable rc-local.service
kemudian cek statusnya dengan perintah :
  systemctl status rc-local.service  


 selesai 

Melihat dan Menambahkan Service di Linux

melihat dan menambahkan sevice di linux fedora :

command yang digunakan adalah : systemctl 

Starting dan stopping services

systemctl start sshd.service
systemctl stop sshd.service
systemctl restart sshd.service

Menjalankan service otomatis

systemctl enable sshd.service 
systemctl disable sshd.service

Mematikan dan Masking services

contoh matikan service dan child proses

  systemctl kill sshd.service
 
mengirim unix signal ke service berjalan
 
  systemctl kill -s USR1 daemon.service
 
 
membekukan service agar tidak bisa berjalan
 
  systemctl mask sshd.service
dalam contoh ini, systemctl membuatkan symlink dari /etc/systemd/system/sshd.service ke /dev/null.
/etc/systemd membaca dari /lib/systemd. systemd dan tidak akan menjalankan service.
 

Perintah systemd yang lain :

sysVinit command systemd command Notes
service sshd start systemctl start sshd.service Used to start a service (not reboot persistent)
service sshd stop systemctl stop sshd.service Used to stop a service. (not reboot persistent)
service sshd restart systemctl restart sshd.service Used to start and stop a service.
service sshd reload systemctl reload sshd.service When supported, reloads the config file without interrupting pending operations.
service sshd condrestart systemctl condrestart sshd.service Restarts if the service is already running.
service sshd status systemctl status sshd.service Tells whether a service is currently running.
ls /etc/rc.d/init.d/ systemctl list-unit-files --type=service Lists all available services.
chkconfig sshd on systemctl enable sshd.service Always run the service at this target (runlevel.)
chkconfig sshd off systemctl disable sshd.service Do not automatically run the service at this target (runlevel.)
chkconfig --list systemctl list-units -t service --all Print a table of available services and their status.
chkconfig sshd --list ls /etc/systemd/system/*.wants/sshd.service Lists the targets that will include the service.
chkconfig sshd --add systemctl daemon-reload Used when you create a service file or modify any configuration.
telinit 3 systemctl isolate multi-user.target Move system into another target (change runlevels.)
[no comparable command] systemctl show -p "Wants" multi-user.target Lists units pulled in by a given target.
[no comparable command] systemctl show -p "After" sshd.service Shows dependent services and other targets.
[no comparable command] systemd --test --system --unit=multi-user.target Simulates booting the system to a given target
[no comparable command] systemd-analyze plot > boot.svg Generates a diagnostically useful graphical representation of the boot process.
ps xawf -eo pid,user,cgroup,args systemd-cgls Display control group process tree.



Monday, August 26, 2013

merubah nama network card di fedora 19



merubah nama network connection

cara 1
edit /etc/udev/rules.d. Edit file 70-persistent-net.rules. ubah baris  NAME="p4p1" menjadi NAME="eth0" kemudian reboot linux anda

cara 2
edit the file /etc/default/grub, tambahkan : "biosdevname=0" pada line GRUB_CMDLINE_LINUX. kemudian rebuild grub.cfg file dengan perintah :

"grub2-mkconfig -o /boot/grub2/grub.cfg" followed by a reboot.

cara 3
cek nama device

 $ ls /sys/class/net
lo eth0 eth1 firewire0

hapus penamaan dynamic pada linux, dengan perintah :

 # ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules

set nama device network card dengan mengedit file /etc/udev/rules.d/

/etc/udev/rules.d/10-network.rules

contoh :

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="net1" SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ff:ee:dd:cc:bb:aa", NAME="net0"

Set device MTU dan queue Length /etc/udev/rules.d/10-network.rules

ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", ATTR{mtu}="1480", ATTR{tx_queue_len}="2000"

cek kembali nama drive

[root]# ls /sys/class/net
eth0 eth1 lo




smoga bermanfaat