Science Cyber

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ

أَعُوْذُ بِاللِه مِنَ الشََّيْطَانِ الرَّجِيْمِ - بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ

Kumpulan CLI CISCO

--Menghidupkan port FE 1/0
router>enable
router#conf terminal
router(config)#interface fastethernet 1/0
router(config-if)#no shut

--Setting Password
router>enable
router#configure terminal
router(config)#enable password rahasia
router(config)#enable secret secret

--Setting Hostname
router>enable
router#configure terminal
router(config)#hostname Router Palembang

--Memberi IP Address
router>enable
router(config)#interface fastethernet 1/0
router(config-if)#ip address 172.25.1.1 255.255.255.0
router(config-if)#desc Gateway Lan Office 'kasih nama'

--Routing Statis
ip route


router>enable
router#configure terminal
router(config)#ip route 192.168.1.0 255.255.255.0 192.168.1.1

--Simpan Konfig
router>enable
router#configure terminal
router(config)#write mem

--Buat Telnet
-router enable
-router#conf t
-router(config)#line vty 0 4
-isikan password

--Setting VLAN
router>enable
router#configure terminal
router(config)#vlan nomor-vlan
router(config-vlan)#name nama-vlan

--Setting IP Address pada VLAN
router>enable
router#configure terminal
router(config)#interface vlan 1
router(config-if)#ip address address mask (misal: ip address 172.10.46.1 255.255.255.0)
router(config-if)#no shutdown

-Setting Identitas pada Port Cisco Catalyst
router>enable
router#configure terminal
router(config)#interface nama-port
router(config-if)#description “Port Setting Identitas”
router(config-if)#end

--Setting IP Gateway
router>enable
router#configure terminal
router(config)#ip default-gateway address

--Setting Port-Speed dan Link-Mode
router#configure terminal
router(config)#interface nama-port (misal : interface fast ethernet 0/1)
router(config-if)#speed 100
router(config-if)#duplex full
router#configure terminal
router(config)#interface nama-port
router(config-if)#switchport mode access
router(config-if)#switchport access vlan nama-vlan
router#configure terminal
router(config)#interface nama-port
router(config-if)#switchport mode trunk
router(config-if)#switchport trunk allowed vlan nama-vlan

--Setting Line VTY
router#configure terminal
router(config)#line vty 0 4
router(config-line)#login
router(config-line)#password password

--Setting Line Con 0
router#configure terminal
router(config)#line con 0
router(config-line)#login
router(config-line)#password password

--Melihat Semua Konfigurasi
router#show running-config

--Menghapus Semua Konfigurasi
router#erase startup-config
router#dir
router#delete flash:vlan.dat
router#dir
-exit

URL with Port

import java.net.*;

import java.io.*;



class url2

{

public static void main(String args[ ]) throws Exception

{

URL aURL = new URL("http://java.sun.com:80/docs/books/"+"tutorial/index.html#DOWNLOADING");

System.out.println("The URL is "+aURL);

System.out.println("protocol = "+aURL.getProtocol());

System.out.println("host = "+aURL.getHost());

System.out.println("filename = "+aURL.getFile());

System.out.println("port = "+aURL.getPort());

System.out.println("ref = "+aURL.getRef());

}

}

URL CONNECTION READER

import java.net.*;

import java.io.*;



class URLConnectionReader

{

public static void main(String[]args) throws Exception

{

URL alamat = new URL("http://www.unisbank.ac.id/");

URLConnection yc = alamat.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));

String inputLine;



while((inputLine = in.readLine()) !=null)

System.out.println(inputLine);



in.close();

}

}

Socket Client

Socket Untuk Client

Kelas java.net.Socket adalah kelas fundamental Java untuk melakukan operasi TCP client-side.

di bawah ini adalah berapa – berapa listing program java menggunakan socket untuk membuat client,ada tiga percobaan silahkan di coba,semoga bisa bermanfaat.

PERCOBAAN 1



import java.net.*;

import java.io.*;



class myport

{

public static void main(String[] args)

{

Socket theSocket;

String host = “localhost”;



for (int i = 0; i < =100; i++) { try { theSocket = new Socket(host, i); System.out.println("There is a server on port " + i + " of " + host); } catch (UnknownHostException e) { System.err.println(e); break; } catch (IOException e) { } } } } PERCOBAAN 2 import java.net.*; import java.io.*; class myport2 { public static void main(String[] args) { Socket theSocket; String host = "localhost"; try { theSocket = new Socket(host,1029); } catch(IOException e) {} for (int i = 1024; i <=1030; i++) { try { theSocket = new Socket(host, i); System.out.println("There is a server on port " + i + " of " + host); } catch (UnknownHostException e) { System.err.println(e); break; } catch (IOException e) { } } } } PERCOBAAN 3 import java.net.*; import java.io.*; class port2 { public static void main(String[] args) { Socket theSocket; String host = "localhost"; if (args.length > 0)

{

host = args[0];

}



try

{

InetAddress theAddress = InetAddress.getByName(host);

for (int i = 1024; i < 65536; i++)

{

try

{

theSocket = new Socket(theAddress, i);

System.out.println(“There is a server on port ” + i + ” of ” + host);

}

catch (IOException e)

{

}

}

}

catch (UnknownHostException e)

{

System.err.println(e);

}

}

}



--------------------------------------------------------------------------------------------------------------------

Socket untuk Server

Kelas ServerSocket berisi semua yang diperlukan untuk menulis server di Java. Ini memiliki konstruktor yang membuat objek baru ServerSocket, metode yang mendengarkan koneksi pada port tertentu, metode yang mengkonfigurasi opsi server berbagai soket, dan bermacam-macam metode biasa seperti toString ().

Dalam pemrograman java siklus hidup dasar dari suatu program server adalah:

1. Sebuah ServerSocket yang baru dibuat pada sebuah port tertentu menggunakan konstruktor ServerSocket ().

2. The ServerSocket mendengarkan upaya koneksi masuk pada port menggunakan metode accept().



3. Tergantung pada jenis server, baik getInputStream Socket’s (), getOutputStream (), atau keduanya dipanggil untuk mendapatkan input dan output stream yang berkomunikasi dengan klien.

4. Server dan klien berinteraksi sesuai dengan yang telah disepakati protokol sampai saatnya untuk menutup koneksi.

5. Server, klien, atau keduanya menutup koneksi.

6. Server kembali ke langkah 2 dan menunggu sambungan berikutnya.



PERCOBAAN 4



import java.net.*;

import java.io.*;



public class anonport

{

public static void main(String[] args)

{

try

{

ServerSocket httpd = new ServerSocket(0);

System.out.println(“This server runs on port ” + httpd.getLocalPort());

}

catch (IOException e)

{

System.err.println(e);

}

}

}



PERCOBAAN 5



import java.net.*;

import java.io.*;



class serverport

{

public static void main(String[] args)

{

ServerSocket theServer;



for (int i = 1024; i <= 65535; i++)

{

try

{

theServer = new ServerSocket(i);

theServer.close();

}

catch (IOException e)

{

System.out.println(“There is a server on port ” + i + “.”);

}

}

}

}



PERCOBAAN 6



import java.net.*;

import java.io.*;



class SocketInfo

{

public static void main(String[] args)

{

String host = “localhost”;

try

{

Socket theSocket = new Socket(host, 80);

System.out.println(“Connected to ” + theSocket.getInetAddress()

+ ” on port ” + theSocket.getPort() + ” from port ”

+ theSocket.getLocalPort() + ” of ” + theSocket.getLocalAddress());

}

catch (UnknownHostException e)

{

System.err.println(“I can’t find ” + host);

}

catch (SocketException e)

{

System.err.println(“Could not connect to ” + host);

}

catch (IOException e)

{

System.err.println(e);

}

}

}

Kumpulan JAVA Programming

Kumpulan materi JAVA
import java.net.*;
class addressIp
{
public static void main (String args[])
{
if (args.length > 0)
{
try
{
// cari semua ip address
InetAddress[] address = InetAddress.getAllByName(args[0]);
// tampilkan semua ip address yang didapat
for (int i=0; i{
System.out.println("Nama: " + address[i].getHostName());
System.out.println("Alamat: " + address[i].getHostAddress());
}
}
// ip address tidak ditemukan
catch (UnknownHostException e)
{
System.out.println("Alamat komputer tidak ditemukan.");
}
} else // argumen tidak ada, tampilkan cara pemakaian program
{
System.out.println("Jalankan dengan perintah: java address \"nama_komputer\"");
System.out.println("Contoh:");
System.out.println("java address google.com");
}
}
}


import java.io.*;
class input2
{
public static void main(String[] args) throws IOException
{
int angka1, angka2;
BufferedReader br;
br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Masukkan Angka1 : ");
angka1 = Integer.parseInt(br.readLine());
System.out.print("Masukkan Angka2 : ");
angka2 = Integer.parseInt(br.readLine());
System.out.println("Angka1 Anda : "+ angka1);
System.out.println("Angka2 Anda : "+ angka2);
}
}

import java.io.*;
class input3
{
public static void main(String[] args) throws IOException
{
int angka1, angka2,jumlah;
BufferedReader br;
br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Masukkan Angka1 : ");
angka1 = Integer.parseInt(br.readLine());
System.out.print("Masukkan Angka2 : ");
angka2 = Integer.parseInt(br.readLine());
System.out.println("Angka1 Anda : "+ angka1);
System.out.println("Angka2 Anda : "+ angka2);
jumlah=angka1 + angka2;
System.out.println("Angka1 + Angka2 : "+ jumlah);
}
}


import java.io.*;
class input4
{
public static void main(String[] args) throws IOException
{
String nama,nim;
int uts,uas;
BufferedReader br;
br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Masukkan Nama Anda : ");
nama= br.readLine();
System.out.print("Masukkan Nim Anda : ");
nim= br.readLine();
System.out.print("Masukkan Nilai UTS : ");
uts = Integer.parseInt(br.readLine());
System.out.print("Masukkan Nilai UAS : ");
uas = Integer.parseInt(br.readLine());
System.out.println("Nama : "+ nama);
System.out.println("Nim : "+ nim);
System.out.println("Nilai UTS : "+ uts);
System.out.println("Nilai UAS : "+ uas);
}
}

import java.net.*;
class myAddress
{
public static void main (String args[])
{
try
{
InetAddress address = InetAddress.getLocalHost();
System.out.println(address);
}
catch (UnknownHostException e)
{
System.out.println("Could not find this computer's address.");
}
}
}

import java.net.*;
class myAddress2
{
public static void main (String args[])
{
try
{
InetAddress address = InetAddress.getByName("www.unisbank.ac.id");
System.out.println(address);
}
catch (UnknownHostException e)
{
System.out.println("Could not find this computer's address.");
}
}
}



import java.net.*;
class myAddressLooping
{
public static void main (String args[])
{
try
{
InetAddress[] address = InetAddress.getAllByName("www.google.com");
for (int i=0; i < address.length; i++)
System.out.println(address [i]);
}
catch (UnknownHostException e)
{
System.out.println("Could not find this computer's address.");
}
}
}



import java.net.*;
import java.io.*;
public class myport
{
public static void main(String[] args)
{
Socket theSocket;
String host = "11.0.3.10";
for (int i = 20; i <=80; i++)
{
try
{
theSocket = new Socket(host, i);
System.out.println("There is a server on port " + i + " of " + host);
}
catch (UnknownHostException e)
{
System.err.println(e);
break;
}
catch (IOException e)
{ }
}
}
}



import java.io.*;
import java.net.*;

public class Reverse {
public static void main(String[] args)throws Exception{
if(args.length !=2){
System.err.println("Usage Error");
System.exit(1);
}

String stringToReverse= URLEncoder.encode(args[1], " UTF-8");

URL url=new URL(args[0]);
URLConnection connection=url.openConnection();
connection.setDoOutput(true);

OutputStreamWriter out=new OutputStreamWriter(connection.getOutputStream());
out.write("string=" + stringToReverse);
out.close();

BufferedReader in= new BufferedReader(new InputStreamReader(connection.getInputStream()));
String decodedString;

while ((decodedString=in.readLine())!=null){
System.out.println(decodedString);
}
in.close();
}
}


import java.net.*;
import java.io.*;
public class serverport
{
public static void main(String[] args)
{
ServerSocket theServer;
for (int i = 1024; i <= 4000; i++)
{
try
{
theServer = new ServerSocket(i);
theServer.close();
}
catch (IOException e)
{
System.out.println("There is a server on port " + i + ".");
}
}
}
}

import java.net.*;
import java.io.*;
public class URLConnectionReader
{
public static void main(String[] args) throws Exception
{
URL alamat = new URL("http://www.unisbank.ac.id");
URLConnection yc = alamat.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}


import java.net.*;
import java.io.*;
public class URLConnectionReader
{
public static void main(String[] args) throws Exception
{
URL alamat = new URL("http://www.unisbank.ac.id");
URLConnection yc = alamat.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}


import java.net.*;
public class urltest1 {
public static void main (String args[]) {
URL webURL, ftpURL;
try {
webURL = new URL("http://www.macfaq.com/vendor.html");
System.out.println(webURL);
ftpURL = new URL("ftq://ftp1.macfaq.com/pub/");
System.out.println(ftpURL);
}
catch (MalformedURLException e) {
System.err.println("URL Salah");
}
}
}



import java.net.*;
public class urltest2
{
public static void main (String args[])
{
URL webURL,ftpURL;
try
{
webURL = new URL("http://he:ri@www.macfaq.com:81/a/bc/def/vendor.html?s=a#AKHIR");
System.out.println(webURL);
String auth, file, host, path, protocol, query, ref, user;
auth = webURL.getAuthority();
System.out.println("Authority = " +auth);
file = webURL.getFile();
System.out.println("File = "+file);
host = webURL.getHost();
System.out.println("Host = "+host);
protocol = webURL.getProtocol();
System.out.println("Protokol = "+protocol);
query = webURL.getQuery();
System.out.println("Query = "+query);
ref = webURL.getRef();
System.out.println("Ref = "+ref);
int port,def_port;
port = webURL.getPort();
System.out.println("Port = "+port);
def_port = webURL.getDefaultPort();
System.out.println("Default Port = "+def_port);
path = webURL.getPath();
System.out.println("Path = "+path);
user = webURL.getUserInfo();
System.out.println("User Info = "+user);
}
catch (MalformedURLException e)
{
System.err.println("URL Salah");
}
}
}

CLI Dasar Cisco





Show ip route



Quote:Perintah show protocols ini berguna untuk menampilkan semua routed protocol dan interface-interface di mana routed protocol tersebut di-enabled (diaktifkan)




Show ip protocols



Quote:Perintah Show ip protocols memperlihatkan pada ente routing protocol yang dikonfigurasi di router ente. Ente bisa melihat bahwa baik RIP maupun IGRP masih bekerja di router, tapi ganya IGRP yang muncul di routing table karena memiliki administrative yang lebih kecil




debug ip rip






Quote:Perintah debug ip rip mengirimkan update-update routing ke session dari konsol, sewaktu update tersebut dikirim dan diterima router. Jika ente telnet ke router, ente perlu menggunakan terminal monitor untuk dapat menerima output dari perintah debug dan untuk memberhentikan perintah ini adalah undebug all



debug ip igrp



Quote:Dalam perintah ini ada 2 pilihan, yaitu events dan transcation




debug ip igrp events






Quote:Perintah debug ip igrp events adalah sebuah rangkuman dari informasi routing IGRP yang berjalan di network. Output router berikut menunjukan asal dan tujuan dari setiap update dan juga jumlah routed setiap update. Untuk menghentikan perintah ini adalah undebug ip igrp events







debug ip igrp transactions



Quote:Perintah debug ip igrp transactions memperlihatkan permintaan dari router tetangga yang meminta update dan broadcast-broadcast yang dikirim dari router ente ke router tetangga






Vlan

Membagi Vlan
#vlan 10
#name Dosen
#int fa0/10
#switch mode access
#switch acc vlan 10

Trunking
#int fa0/24
#switchport mode trunk
#exit
#vlan 99
#name vlannative

#int fa0/24
#switchport trunk native vlan 99

Menampilakn config vlan
#show vlan





Membuat password EXEC Cisco



membuat password konsole
(config)#line console 0
(config-line)#password (cisco)
(config-line)#login
ctrl c
R1#copy run start
R1#Reload

membuat password privilages
enable password
(config)#enable password (cisco)

config telnet
(config) line vty
(config-line)password (cisco)
(config-line)login
ctr C
R1#copy run start

Click Here To More Information

والله أعلم بالصواب

وَعَلَيْكُمْ السَّلاَمُ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ