Sei sulla pagina 1di 27

Remote Machine Event Handling Remote Client Code: import javax.swing.ImageIcon; import java.awt.*; import java.awt.event.*; import java.awt.image.

*; import java.io.*; import java.util.*; import java.lang.*; import java.lang.Object.*; import java.net.*; import javax.imageio.ImageIO; import java.lang.Thread; public class RemoteClient extends Thread { static int port=1800; BufferedReader br1; static BufferedReader br2; static InetAddress ia; static Socket ds; Robot rr; DataInputStream di; FileOutputStream fos; ImageIcon imico; public static Image toImage(BufferedImage bufferedImage) { return Toolkit.getDefaultToolkit().createImage(bufferedImage.getSource()); } public void run() { while(true) { try { Dimension screenSize= Toolkit.getDefaultToolkit().getScreenSize(); //ia=InetAddress.getByName("127.0.0.1"); ds=new Socket("127.0.0.1",port); InetAddress self=InetAddress.getLocalHost() ; rr=new Robot(); imico=new ImageIcon(rr.createScreenCapture(new Rectangle(0,0,screenSize.width,screenSize.height)).getScaledInstance(640,4 80,Image.SCALE_SMOOTH));

ObjectOutputStream oos=new ObjectOutputStream(ds.getOutputStream()); oos.writeObject(imico); Thread.sleep(10); String str=imico.toString(); System.out.println(str); } catch(Exception e) { System.out.println(e); } } } public static void main(String args[]) { try { RemoteClient remc=new RemoteClient(); remc.start(); //remc.sleep(100); } catch(Exception e) { System.out.println(e); } } }

Remote Server Code: import javax.swing.*; import javax.swing.ImageIcon; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.io.*; import java.util.*; import java.lang.*; import java.lang.Object.*; import java.net.*; import javax.imageio.ImageIO; import java.awt.event.ActionEvent; public class RemoteServer extends JFrame implements Runnable { static Container ct; static JPanel clientscreen; static JButton disconnect; Thread td; RemoteServer() { td=new Thread(this); ct=getContentPane(); clientscreen= new JPanel(); clientscreen.setLayout(new BorderLayout()); ct.setLayout(new BorderLayout()); JPanel next=new JPanel(); next.setLayout(new BorderLayout()); disconnect=new JButton("Diconnect"); next.add(disconnect); //jlbl=new JButton(""); } public static Image toImage(BufferedImage bufferedImage) { return Toolkit.getDefaultToolkit().createImage(bufferedImage.getSource()); }

public void run() { try { int port= 1800; ServerSocket rd=new ServerSocket(port); Robot r1=new Robot(); Socket sock=null; ObjectInputStream ois; JButton jlbl=new JButton(); while(true) { sock=rd.accept(); ObjectInputStream oim=new ObjectInputStream(sock.getInputStream()); ImageIcon ico=(ImageIcon)oim.readObject(); jlbl.setIcon(ico); clientscreen.add(jlbl); ct.add(clientscreen); ct.repaint(); td.sleep(10); setSize(800,600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("Remote Management Server"); setResizable(false); setVisible(true); show(); } } catch(Exception e) { System.out.println(e); } } public static void main(String args[]) { RemoteServer rs=new RemoteServer(); rs.td.start(); } }

Post Office Protocol 3 ( POP3 ) Code: import javax.mail.*; import javax.mail.internet.*; import java.util.*; import java.io.*; public class POP3Client { public static void main(String[] args) { Properties props = new Properties(); String host = "hirenserver"; String username = "hiren"; String password = "1234 AbCd"; String provider = "pop3"; try { Session session = Session.getDefaultInstance(props, null); Store store = session.getStore(provider); store.connect(host, username, password); Folder inbox = store.getFolder("INBOX"); // create a Folder object of the inbox. if (inbox == null) { System.out.println("No INBOX"); System.exit(1); } inbox.open(Folder.READ_ONLY);// open the Folder. Message[] messages = inbox.getMessages(); for (int i = 0; i < messages.length; i++) { System.out.println("------------ Message " + (i+1) + " ------------"); messages[i].writeTo(System.out); }

inbox.close(false); store.close(); } catch (Exception ex) { ex.printStackTrace(); } } }

Simple Mail Transfer Protocol ( SMTP ) Code: import java.util.*; import javax.mail.*; import javax.mail.internet.*; public class SMTPClient { public static void main(String args[]) throws Exception { String host = "199.34.57.254"; String from = "@"; String to = "@"; Properties properties = System.getProperties(); properties.setProperty("mail.smtp.host", host); Session session = Session.getDefaultInstance(properties); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject("hi..!"); message.setText("Hi ......"); Transport.send(message); System.out.println("Message Send....."); } }

File Transfer Protocol ( FTP ) Code for Uploading: import java.net.*; import java.io.*; import java.lang.*; public class SimpleFTPClientXP { private URLConnection m_client; private String host; private String user; private String password; private String remoteFile; private String succMesg; private String erMesg; public SimpleFTPClientXP(){} public void setHost(String host) { this.host=host; } public void setUser(String user) { this.user=user; } public void setPassword(String p) { this.password=p; } public void setRemoteFile(String d) { this.remoteFile=d; System.out.println(d); }

public synchronized String getLastErrorMessage() { if(erMesg==null) return ""; return erMesg; } public synchronized String getLastSuccessMessage() { if(succMesg==null) return ""; return succMesg; } public synchronized boolean uploadFile(String localfilename) { try { SimpleFTPClientXP f=new SimpleFTPClientXP(); System.out.println("Upload File" +localfilename); InputStream is=new FileInputStream(localfilename); BufferedInputStream bis=new BufferedInputStream(is); OutputStream os=m_client.getOutputStream(); BufferedOutputStream bos=new BufferedOutputStream(os); byte[] buffer=new byte[1024]; int readCount; while((readCount = bis.read(buffer))>0) { bos.write(buffer,0,readCount); } bos.close(); is.close(); this.succMesg="Uploaded!"; return true; } catch(Exception ex) { StringWriter sw0=new StringWriter(); PrintWriter p0=new PrintWriter(sw0,true); ex.printStackTrace(p0); erMesg=sw0.getBuffer().toString(); return false; } }

public synchronized boolean connect(String fname) { try { remoteFile=fname+".txt"; URL url=new URL("ftp://"+user+":"+password+"@"+host+"/"+remoteFile+";type =i"); System.out.println(url); m_client=url.openConnection(); return true; } catch(Exception ex) { StringWriter sw0=new StringWriter(); PrintWriter p0=new PrintWriter(sw0,true); ex.printStackTrace(p0); erMesg=sw0.getBuffer().toString(); return false; } } public static void main(String args[]) { SimpleFTPClientXP f=new SimpleFTPClientXP(); String fname="u1"; f.setHost("192.168.10.55"); f.setUser("Administrator"); f.setPassword("one"); boolean connected=f.connect(fname); f.setRemoteFile(fname); if(connected) { if(f.uploadFile("S.txt")) { System.out.println(f.getLastSuccessMessage()); } else { System.out.println(f.getLastErrorMessage()); } } else System.out.println(f.getLastErrorMessage()); System.out.println("remoteFileset"); } }

Code for Downloading: import java.net.*; import java.io.*; import java.lang.*; public class SimpleFTPClientXP { private URLConnection m_client; private String host; private String user; private String password; private String remoteFile; private String succMesg; private String erMesg; public SimpleFTPClientXP(){} public void setHost(String host) { this.host=host; } public void setUser(String user) { this.user=user; } public void setPassword(String p) { this.password=p; } public void setRemoteFile(String d) { this.remoteFile=d; System.out.println(d); } public synchronized String getLastErrorMessage() { if(erMesg==null) return ""; return erMesg; } public synchronized String

getLastSuccessMessage() { if(succMesg==null) return ""; return succMesg; } public synchronized boolean downloadFile(String localfilename) { try { System.out.println("Download File" +localfilename); InputStream is=m_client.getInputStream(); BufferedInputStream bis=new BufferedInputStream(is); OutputStream os=new FileOutputStream(localfilename); BufferedOutputStream bos=new BufferedOutputStream(os); byte[] buffer=new byte[1024]; int readCount; while((readCount = bis.read(buffer))>0) { bos.write(buffer,0,readCount); } bos.close(); is.close(); this.succMesg="Downloaded!"; return true; } catch(Exception ex) { StringWriter sw0=new StringWriter(); PrintWriter p0=new PrintWriter(sw0,true); ex.printStackTrace(p0); erMesg=sw0.getBuffer().toString(); return false; } } public synchronized boolean connect(String fname) { try { remoteFile=fname+".txt"; URL url=new URL("ftp://"+user+":"+password+"@"+host+"/"+remoteFile+";type =i"); System.out.println(url); m_client=url.openConnection(); return true;

} catch(Exception ex) { StringWriter sw0=new StringWriter(); PrintWriter p0=new PrintWriter(sw0,true); ex.printStackTrace(p0); erMesg=sw0.getBuffer().toString(); return false; } } public static void main(String args[]) { SimpleFTPClientXP f=new SimpleFTPClientXP(); String fname="u1"; f.setHost("192.168.10.55"); f.setUser("Administrator"); f.setPassword("one"); boolean connected=f.connect(fname); f.setRemoteFile(fname); if(connected) { if(f.downloadFile("mydl.txt")) { System.out.println(f.getLastSuccessMessage()); } else { System.out.println(f.getLastErrorMessage()); } } else { System.out.println(f.getLastErrorMessage()); } } }

Instant Messenger

Client Side Code: import java.io.*; import java.net.*; class client1 { public static void main(String arg[]) { int port=9999; Socket s; String str,msg="",msg1=""; try { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); InetAddress addr=InetAddress.getByName(null); s=new Socket(addr,port); OutputStreamWriter osw=new OutputStreamWriter OutputStreamWriter(s.getOutputStream()); PrintWriter pw=new PrintWriter(osw); BufferedReader br1=new BufferedReader(new InputStreamReader(s.getInputStream())); BufferedReader br2=new BufferedReader(new InputStreamReader(s.getInputStream())); pw.println(); pw.flush(); msg=br1.readLine(); System.out.println("Connection Established with server: "); System.out.println(msg); str=br.readLine(); pw.println(str); pw.flush(); msg1=br2.readLine(); System.out.println("The answer from server: "); System.out.println(msg1); } catch(Exception e) {} } }

Server Side Code: import java.io.*; import java.net.*; import java.util.*; class server1 implements Runnable { Socket s; int id; public static void main(String arg[]) { int port=9999,count=0; try { ServerSocket ss=new ServerSocket(port); System.out.println("Waiting for client"); while(true) { Socket s=ss.accept(); server1 serve=new server1(s,count); Thread t=new Thread(serve); t.start(); } } catch(Exception e) {} } server1(Socket s,int id) { this.s=s; this.id=id; } public void run() { try { BufferedReader br=new BufferedReader(new InputStreamReader(s.getInputStream())); BufferedReader br1=new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter pw=new PrintWriter(new OutputStreamWriter(s.getOutputStream())); PrintWriter pw1=new PrintWriter(new OutputStreamWriter(s.getOutputStream())) ; pw.flush();

String st = "",str,str1; str=br.readLine(); System.out.println("Msg from Client: " + str); Date d=new Date(); st="Hello Client. Today is : " + d; pw.println(st); pw.flush(); str1=br1.readLine(); System.out.println("Msg from Client: "+str1); pw1.println("You have typed : "+str1); pw1.flush(); s.close(); } catch(Exception e) {} } }

Simulating Routing Techniques

1) Configure all the Three Routers by Enabling the Interface 2) Configure Routing Protocols such as RIP and OSPF 3) Ping Router to Router Router R1 Router>enable Router#config terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R1 R1(config)#enable password cisco1 R1(config)#interface loopback 0 R1(config-if)#ip address 1.1.1.1 255.255.255.0 R1(config-if)#interface s0/0 R1(config-if)#ip address 10.1.1.1 255.255.255.0 R1(config-if)#no shutdown R1(config-if)# *Mar 1 00:14:55.947: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up R1(config-if)# *Mar 1 00:14:58.955: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up R1(config-if)#^Z R1# *Mar 1 00:16:04.679: %SYS-5-CONFIG_I: Configured from console by console R1#show ip interface brief Interface IP-Address OK? Method Status Protocol Serial0/0 10.1.1.1 YES manual up up Serial0/1 unassigned YES unset administratively down down Serial0/2 unassigned YES unset administratively down down Serial0/3 unassigned YES unset administratively down down Loopback0 1.1.1.1 YES manual up up

R1#show running-config Building configuration... Current configuration : 937 bytes version 12.3 service timestamps debug datetime ms service timestamps log datetime msec no service password-encryption hostname R1 boot-start-marker boot-end-marker enable password cisco1 no aaa new-model resource policy memory-size iomem 5 ip subnet-zero ip cef no ip dhcp use vrf connected interface Loopback0 ip address 1.1.1.1 255.255.255.0 interface Serial0/0 ip address 10.1.1.1 255.255.255.0 serial restart-delay 0 no dce-terminal-timing-enable interface Serial0/1 no ip address shutdown serial restart-delay 0 no dce-terminal-timing-enable interface Serial0/2 no ip address shutdown serial restart-delay 0 no dce-terminal-timing-enable interface Serial0/3 no ip address shutdown serial restart-delay 0 no dce-terminal-timing-enable ip http server ip classless control-plane line con 0 line aux 0 line vty 0 4 end R1#config terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)#router rip

R1(config-router)#version 1 R1(config-router)#network 1.1.1.0 R1(config-router)#network 10.1.1.0 R1(config-router)#no auto-summary R1(config-router)#^Z R1# *Mar 1 00:49:07.247: %SYS-5-CONFIG_I: Configured from console by console R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 R 2.0.0.0/8 [120/1] via 10.1.1.2, 00:00:05, Serial0/0 R 3.0.0.0/8 [120/2] via 10.1.1.2, 00:00:05, Serial0/0 R 20.0.0.0/8 [120/1] via 10.1.1.2, 00:00:05, Serial0/0 10.0.0.0/24 is subnetted, 1 subnets C 10.1.1.0 is directly connected, Serial0/0 R1#show ip protocols Routing Protocol is "rip" Sending updates every 30 seconds, next due in 28 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 1, receive version 1 Interface Send Recv Triggered RIP Key-chain Serial0/0 1 1 Loopback0 1 1 Automatic network summarization is not in effect Maximum path: 4 Routing for Networks: 1.0.0.0 10.0.0.0 Routing Information Sources: Gateway Distance Last Update 10.1.1.2 120 00:00:07 Distance: (default is 120) R1#ping 20.1.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 20.1.1.2, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 40/88/192 ms R1#config terminal

R1(config)#router ospf 100 R1(config-router)#network 1.1.1.0 0.0.0.255 area 0 R1(config-router)#network 10.1.1.0 0.0.0.255 area 0 R1>enable R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level ia - IS-IS inter area, * - candidate default, U - per-user static r o - ODR, P - periodic downloaded static route Gateway of last resort is not set 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 10.1.1.2, 00:01:10, Serial0/0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/66] via 10.1.1.2, 00:01:10, Serial0/0 20.0.0.0/24 is subnetted, 1 subnets O 20.1.1.0 [110/65] via 10.1.1.2, 00:01:10, Serial0/0 10.0.0.0/24 is subnetted, 1 subnets C 10.1.1.0 is directly connected, Serial0/0 R1#show ip protocols Routing Protocol is "ospf 100" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 1.1.1.1 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: 1.1.1.0 0.0.0.255 area 0 10.1.1.0 0.0.0.255 area 0 Routing Information Sources: Gateway Distance Last Update 3.3.3.3 110 00:08:42 2.2.2.2 110 00:08:42 1.1.1.1 110 00:08:42 Distance: (default is 110) Router R2 Router>enable Router#config terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R2 R2(config)#enable password cisco2 R2(config)#interface loopback 0

R2(config-if)#ip address 2.2.2.2 255.255.255.0 R2(config-if)#interface s0/0 R2(config-if)#ip address 10.1.1.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#interface fa1/0 R2(config-if)#ip address 20.1.1.1 255.255.255.0 R2(config-if)#no shutdown R2(config-if)# *Mar 1 00:14:55.947: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up R2(config-if)# *Mar 1 00:14:58.955: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up R2(config-if)#^Z R2# *Mar 1 00:16:04.679: %SYS-5-CONFIG_I: Configured from console by console R2#show ip interface brief Interface IP-Address OK? Method Status Protocol Serial0/0 10.1.1.2 YES manual up up Serial0/1 unassigned YES unset administratively down down Serial0/2 unassigned YES unset administratively down down Serial0/3 unassigned YES unset administratively down down FastEthernet1/0 20.1.1.1 YES manual up up Loopback0 2.2.2.2 YES manual up up R2#show running-config Building configuration... Current configuration : 1025 bytes version 12.3 service timestamps debug datetime service timestamps log datetime ms no service password-encryption hostname R2 boot-start-marker boot-end-marker enable password cisco2 no aaa new-model resource policy memory-size iomem 5 ip subnet-zero ip cef no ip dhcp use vrf connected interface Loopback0 ip address 2.2.2.2 255.255.255.0 interface Serial0/0 ip address 10.1.1.2 255.255.255.0 serial restart-delay 0 no dce-terminal-timing-enable interface Serial0/1 no ip address

shutdown serial restart-delay 0 no dce-terminal-timing-enable interface Serial0/2 no ip address shutdown serial restart-delay 0 no dce-terminal-timing-enable interface Serial0/3 no ip address shutdown serial restart-delay 0 no dce-terminal-timing-enable interface FastEthernet1/0 ip address 20.1.1.1 255.255.255.0 duplex auto speed auto ip http server ip classless control-plane line con 0 line aux 0 line vty 0 4 end R2#config terminal Enter configuration commands, one per line. End with CNTL/Z. R2(config)#router rip R2(config-router)#version 1 R2(config-router)#network 2.2.2.0 R2(config-router)#network 10.1.1.0 R2(config-router)#network 20.1.1.0 R2(config-router)#no auto-summary R2(config-router)#^Z R2# *Mar 1 00:51:13.267: %SYS-5-CONFIG_I: Configured from console by console R2#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set R 1.0.0.0/8 [120/1] via 10.1.1.1, 00:00:07, Serial0/0 2.0.0.0/24 is subnetted, 1 subnets C 2.2.2.0 is directly connected, Loopback0 R 3.0.0.0/8 [120/1] via 20.1.1.2, 00:00:25, FastEthernet1/0

20.0.0.0/24 is subnetted, 1 subnets C 20.1.1.0 is directly connected, FastEthernet1/0 10.0.0.0/24 is subnetted, 1 subnets C 10.1.1.0 is directly connected, Serial0/0 R2#show ip protocols Routing Protocol is "rip" Sending updates every 30 seconds, next due in 23 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 1, receive version 1 Interface Send Recv Triggered RIP Key-chain Serial0/0 1 1 FastEthernet1/0 1 1 Loopback0 1 1 Automatic network summarization is not in effect Maximum path: 4 Routing for Networks: 2.0.0.0 10.0.0.0 20.0.0.0 Routing Information Sources: Gateway Distance Last Update 10.1.1.1 120 00:00:21 20.1.1.2 120 00:00:21 Distance: (default is 120) R2#config terminal R2(config)#router ospf 100 R2(config-router)#network 2.2.2.0 0.0.0.255 area 0 R2(config-router)#network 10.1.1.0 0.0.0.255 area 0 R2(config-router)#network 20.1.1.0 0.0.0.255 area 0 R2#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/65] via 10.1.1.1, 00:02:48, Serial0/0 2.0.0.0/24 is subnetted, 1 subnets C 2.2.2.0 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/2] via 20.1.1.2, 00:02:48, FastEthernet1/0 20.0.0.0/24 is subnetted, 1 subnets

20.1.1.0 is directly connected, FastEthernet1/0 10.0.0.0/24 is subnetted, 1 subnets C 10.1.1.0 is directly connected, Serial0/0 R2#show ip protocols Routing Protocol is "ospf 100" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 2.2.2.2 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: 2.2.2.0 0.0.0.255 area 0 10.1.1.0 0.0.0.255 area 0 20.1.1.0 0.0.0.255 area 0 Routing Information Sources: Gateway Distance Last Update 3.3.3.3 110 00:09:44 1.1.1.1 110 00:09:44 2.2.2.2 110 00:09:44 Distance: (default is 110) Router R3 Router>enable Router#config terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R3 R3(config)#enable password cisco3 R3(config)#interface loopback 0 R3(config-if)#ip address 3.3.3.3 255.255.255.0 R3(config-if)#interface fa0/0 R3(config-if)#ip address 20.1.1.2 255.255.255.0 R3(config-if)#no shutdown R3(config-if)# *Mar 1 00:14:55.947: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up R3(config-if)# *Mar 1 00:14:58.955: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up R3(config-if)#^Z R3#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 20.1.1.2 YES manual up up Loopback0 3.3.3.3 YES manual up up R3#show running-config Building configuration... Current configuration : 607 bytes version 12.3 service timestamps debug datetime msec

service timestamps log datetime msec no service password-encryption hostname R3 boot-start-marker boot-end-marker enable password cisco3 no aaa new-model resource policy memory-size iomem 5 ip subnet-zero ip cef no ip dhcp use vrf connected interface Loopback0 ip address 3.3.3.3 255.255.255.0 interface FastEthernet0/0 ip address 20.1.1.2 255.255.255.0 duplex auto speed auto ip http server ip classless control-plane line con 0 line aux 0 line vty 0 4 end R3#config terminal Enter configuration commands, one per line. End with CNTL/Z. R3(config)#router rip R3(config-router)#version 1 R3(config-router)#network 3.3.3.0 R3(config-router)#network 20.1.1.0 R3(config-router)#no auto-summary R3(config-router)#^Z R3# *Mar 1 00:53:05.339: %SYS-5-CONFIG_I: Configured from console by console R3#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static rout o - ODR, P - periodic downloaded static route Gateway of last resort is not set R 1.0.0.0/8 [120/2] via 20.1.1.1, 00:00:15, FastEthernet0/0 R 2.0.0.0/8 [120/1] via 20.1.1.1, 00:00:15, FastEthernet0/0 3.0.0.0/24 is subnetted, 1 subnets C 3.3.3.0 is directly connected, Loopback0

20.0.0.0/24 is subnetted, 1 subnets C 20.1.1.0 is directly connected, FastEthernet0/0 R 10.0.0.0/8 [120/1] via 20.1.1.1, 00:00:15, FastEthernet0/0 R3#show ip protocols Routing Protocol is "rip" Sending updates every 30 seconds, next due in 24 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 1, receive version 1 Interface Send Recv Triggered RIP Key-chain FastEthernet0/0 1 1 Loopback0 1 1 Automatic network summarization is not in effect Maximum path: 4 Routing for Networks: 3.0.0.0 20.0.0.0 Routing Information Sources: Gateway Distance Last Update 20.1.1.1 120 00:00:19 Distance: (default is 120) R3#configure terminal R3(config)#router ospf 100 R3(config-router)#network 3.3.3.0 0.0.0.255 area 0 R3(config-router)#network 20.1.1.0 0.0.0.255 area 0 R3#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS levelia - IS-IS inter area, * - candidate default, U - per-user static ro o - ODR, P - periodic downloaded static route Gateway of last resort is not set 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/66] via 20.1.1.1, 00:03:57, FastEthernet0/0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/2] via 20.1.1.1, 00:03:57, FastEthernet0/0 3.0.0.0/24 is subnetted, 1 subnets C 3.3.3.0 is directly connected, Loopback0 20.0.0.0/24 is subnetted, 1 subnets C 20.1.1.0 is directly connected, FastEthernet0/0 10.0.0.0/24 is subnetted, 1 subnets O 10.1.1.0 [110/65] via 20.1.1.1, 00:03:57, FastEthernet0/0 R3#show ip protocols Routing Protocol is "ospf 100"

Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 3.3.3.3 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: 3.3.3.0 0.0.0.255 area 0 20.1.1.0 0.0.0.255 area 0 Routing Information Sources: Gateway Distance Last Update 1.1.1.1 110 00:05:16 2.2.2.2 110 00:05:16 3.3.3.3 110 00:05:16 Distance: (default is 110)